1

I need to swap out the Laravel Queue connection when I queue certain items.

E.g. default is redis but I need to swap it out to use sqs when I queue certain items.

Is there anyway to do this without having to change the default queue connection using Config::set('queue.default', 'sqs');?

I notice it's easy to specify which queue name to use by passing it as a third argument to Queue:push(), but this only let's you change the queue name, not the queue connection itself.

1 Answer 1

1

You can use Queue::connection to swith to another connection.

Queue::connection('new-connection')->push('QueueClass@queueMethod', [], 'queue-name');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.