Currently i'm working with nodejs and i create queue with Rabbitmq.
I have process that only push to the queue new tasks to done and i can have like 500+tasks/s to push.
Now from consumer side i get the elements from the queue and process them. With only single process things get pretty slow. I decided to create multiple process that consume the queue.
Now what's the problem?
Some tasks have to be done sequentially, what i mean?
(Im using mongodb as database)
imagine i have to change a status like true/false
(task1) change status of element with id 1 to false -> process 1
(task2) change status of element with id 1 to true -> process 2
now somehow process 2 executes task 2 before task 1(process) my final document is incongruent resulting true instead of false.
Tech: nodejs, rabbitmq(for queue).
Any idea how can i solve this? i guess mutex won't work here.