Have this design problem and trying to find a best way to implement it using JMS.
Web App has single Listener and multiple Producer and multiple WorkerBee. Listener pushes messages from its queue to WorkerBee. All of the messages produced are queued in a Listener. I want to implement a process than can send messages from Listener queue to each WorkerBee using some kind of load balancing process. Only single instance of the message occurs in the Listener queue or in the WorkerBee queue.
Whats the best way to do it? Does JMS sounds like a good choice here? How would I push the message from Listener queue to WorkerBee queue?
Open for suggestion :) And appreciate your response.
Messaging is good choice for such task. I think you should use Apache Camel framework as routing platform for described purposes. It allows to divide business logic from integration level in quite graceful way.
Camel supports plenty of components "out-of-box" including JMS endpoints.
You can delegate to one of your WorkerBee's using Load Balancer pattern.
JMS sounds a good option, since you have multiple instances of WorkerBee, make all WorkerBee listen to a single queue, e.g. to InWorkBeeQueue.
Now you can publish messages from Web App listener to InWorkBeeQueue. Write a simple java JMS producer code to publish messages to this queue. Depending on whichever instance of WorkBee is free, it will read message from InWorkBeeQueue and process it.
If you want to avoid writing new JMS producer code, you can directly map messages from Web app queue to InWorkBeeQueue using Apache Camel routes.