Support the ongoing development of Laravel.io →
posted 8 years ago
Queues
Last updated 7 months ago.
0

Can you just queue the firing of the function and then when that queue job fires run the loop?

Last updated 7 months ago.
0

awestrope said:

Can you just queue the firing of the function and then when that queue job fires run the loop?

That seems redundant. What I'd like to do is something like this:

for ($i = 0; $i < 1000; $i++) {
    Queue::add("message");
}
Queue::pushAll("queue_name");

where pushAll() would use native driver's bulk/batch API (I know IronMQ and SQS has it, not sure about the others) or use foreach loop to push each message if driver has no bulk/batch API.

For now I think I'll just use native client like this:

Queue::getIron()->postMessages("queue_name", $messages);

and work on more elegant solution when I have some free time.

Last updated 7 months ago.
0

super late reply, but how did you create the $messages array?

I can't find a way to create the individual payloads

Last updated 7 months ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

arnaslu arnaslu Joined 7 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.