-
Notifications
You must be signed in to change notification settings - Fork 20
What is Consumer Dispatcher and Why
Consumer Dispatcher works as a proxy between RabbitMQ and your consumers. Let you scale out and maintain consumers easily.
It can work with all http-based interfaces in any language.
- You can utilize the functionalities Consumer Dispatcher provides (see next section).
- When you are using MVC implementation for your project, it makes you easier to write consumer code, scale them out and maintain the consumers. Since Consumer Dispatcher calls your consumer code by sending http request (how does it work, http request format), you could reuse your infrastructure (like nginx + php) and reuse most of your code to process the business logic (still in MVC way).
If you've checked out the job.xml, you understand that each job definition is for a specific queue. Consumer Dispatcher internally creates a thread pool for each job. So managing a specific pool (like, adding/removing more executors, purging queue..etc) wont affect the other pool(job).
say, you are running one Consumer Dispatcher instance for 2 websites. Stopping all consumers for one website wont affect the consumers running there for the other site.
If you run into the case that you need to consume a queue faster (eg: the size of your queued job increased dramatically for some reason), you can add more job executors (increase the number of threads in the pool) without stopping the other consumers just by clicking a button. (how to use)
In case you dont need to have a lot of jobs being dispatched concurrently, you can remove X number of job executors by clicking a button. (how to use)
There is a case that you want to purge a queue, especially there are a lot bad jobs in the queue. If you are using queue in acknowledge modle and running multiple consumers for that queue, it's very possible that it needs you to stop all consumers before you are able to purge the queue. In this case, you have to login to consumer server to stop, then to rabbitmq server to purge.
By using Consumer Dispatcher, you just need to click the purge button. (how to use)
Purge function mentioned above is a good tool. But what if there are bad and good jobs mixed in a queue. Simply purging it will loose good data. However, leaving bad jobs there will block the good ones to be consumed.
In that case what we need is to get the bad jobs passed with logging their data to a file (for more investigation) and to consume the good jobs properly. You can achieve that by click a button.
Being able to check how many jobs have been consumed for a specific queue. (how to use)
No single point of failure ? Got problem with purging queue when you have multiple instances running there? then you can run in master-slave way