Skip to content

[5.8] Remove prefix setting for Amazon SQS, add url #27086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

alexkb
Copy link
Contributor

@alexkb alexkb commented Jan 7, 2019

When using Amazon SQS as the queue backend, it's not convenient to have the queue name automatically appended to the Amazon SQS endpoint URL. This is because the Amazon SQS URL may need to be different depending on environment, whilst the queue name should remain the same, given code Job::dispatch()->onQueue('emails') and queue:work --queue=emails commands will specify it.

This PR removes the use of the SQS specific setting prefix and relies on a new SQS specific setting url. This means it can change independently of the queue name.

This is a obviously, a breaking change so it would have to be in a major version release if it was accepted.

A PR over on the laravel/laravel repository to update config/queue.php has also been submitted.

@alexkb alexkb changed the title Sqs queue url Use a url instead of a prefix setting for Amazon SQS Jan 7, 2019
@alexkb alexkb changed the title Use a url instead of a prefix setting for Amazon SQS Remove prefix setting for Amazon SQS, add url Jan 7, 2019
@alexkb alexkb changed the title Remove prefix setting for Amazon SQS, add url [5.8] Remove prefix setting for Amazon SQS, add url Jan 7, 2019
@taylorotwell
Copy link
Member

Just make the full URL your queue name this in this case and remove the prefix option entirely from your configuration.

@alexkb
Copy link
Contributor Author

alexkb commented Jan 7, 2019

Thanks for taking a look at this @taylorotwell, but if you "make the full URL your queue name", that same queue name has to be mentioned in your enqueue calls and queue:work command if you utilise queue names, does it not?

@alexkb
Copy link
Contributor Author

alexkb commented Jan 7, 2019

Ok, so I checked with @taylorotwell: if you use his proposed solution of setting the prefix to empty and putting the full queue url in the queue name setting, you can get away with things by having duplicate queue connections for each queue and then just relying on the connection name. So in your caller code you would do this: Queue::connection('foo')->push() and in the queue:work command you can simply pass the connection name as an argument.

Thanks @taylorotwell!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants