I have a python script that is to be a celery task. My application needs a number of concurrent workers(from the same script) because each worker needs to process the messages sequentially. I cannot use the parameter concurrency = n because then the messages are not processed sequentially which is kind of a requirement.
So what I have done is set up 'n' different queues in the message broker and then start 'n' different workers and each of those workers processes each queue separately, and I have put concurrency = 1 in each worker so each queue is processed sequentially. The workers are from the same script so to start those workers I have to copy the script n times and run all of them parallel in different threads.
This does not seem to me to be the most efficient way to achieve this as the code is copied a number of times. Is there any other way to achieve this?
Let me know if any more details are required.