One process is producer of Bull queue(javascript) and 3 processes are consumer of the same queue.
Queued data by the producer process are paired and chronological order.
Each data object is like this : {order:1-1}, {order:1-2}, {order:2-1}, {order:2-2}.....
{order:1-1}, {order:1-2} data are paired ,and each data is in queuing chronological order.
It should also be dequeued chronologically.
If they are dequeued like {order:1-2}, {order:1-1}, it's useless.
When I run a single consumer process, dequeued data are chronological.
But, when the multi processes consume the queue, the dequeued data are not in the chronological order.
I think dequeued data by the multi processes are not FIFO.
It seems dequeued out of order.
So, I've tried to limit the process count to access queue at the moment.
I think the concurrency setting can be used for this.
const queue = new Qeueu('test', {
redis :{
host : 'localhost',
port : 6379
},
settings : {
concurrency : 1
}
But, the result is the same with before. Output of paired data are not in chronological order.
When I checked the queue status, the active count was 3.
It means that 3 queue was activated by the 3 process. My purpose is only one process access queue at the moment
I think that the concurrency setting is not working.
Or I'm applied incorrectly.
Here are summarizing my questions:
- In the Bull queue(redis), are dequeued data not in chronological order if multi processes consume queue?
- Or basically, it's not possible to keep chronological order in the multi processes because each process's processing time different.
So, output will be out of order even though they read queued data in chronological order.
If so, is there any solution in chronological order? - How to set Bull queue if I want to make only one process can access the queue at the moment?