Hello.
I have a question.
Say we are using yiisoft/yii2-queue extension.
Is there a possibility to get many tasks from queue and work with all of them?
For example we push many tasks every one says that we need to reindex this article.
But when we need to process them, we need to gather many of them so we could do actual work in bathes (send actual api request to elastic to _bult endpoint).
Not senging many api to update every document in index
The idea somehow defeats the purpose of using the queue. You can process it differently. Push the actions to be done in some table then in the queue task (probably delayed) proceed them all at once. If have none, you can push the job to the queue again. You can use events for this. Bit ugly but should work.
@Pathfinder, @BartQ76 has the correct answer. The purpose of a queue is to have one worker do one job. If you need batching then I would probably design the system in a way that allows for a queue job to look for a batch - maybe in a batches table?
You could just queue these tasks then have a cron run that pulls down all the entries from the queue table and do it in one execution. That is kind of a bastardization of the queue system but it would work.