JMS Messages and JMS Message Load Balancing

Ask this problem and try to find the best way to implement it using JMS.

The web application has one listener and several producers and several WorkerBee. The listener pushes messages out of its queue in WorkerBee. All received messages are queued in the Listener. I want to implement a process than send messages from the Listener queue to each WorkerBee, using some kind of load balancing process. Only one instance of the message occurs in the Listener queue or in the WorkerBee queue.

What is the best way to do this? Is JMS a good choice here? How can I send a message from a Listener queue to a WorkerBee queue?

Open to suggestions :) And rate your answer.

0
spring spring-mvc jms activemq
source share
2 answers

Messages are a good choice for such a task. I think you should use Apache Camel as a routing platform for the described purposes. This allows you to gracefully separate the business logic with the level of integration.

Camel supports many out-of-the-box components, including JMS endpoints . You can delegate one of your WorkerBee using the Load Balancer .

+3
source share

JMS sounds good as you have multiple instances of WorkerBee so that the entire WorkerBee listens on one queue, for example. to InWorkBeeQueue.

You can now post messages from the Web App listener to InWorkBeeQueue. Write simple JMS vendor Java code to post to this queue. Depending on which instance of the WorkBee is free, it will read the message from InWorkBeeQueue and process it.

If you want to avoid writing new JMS vendor code, you can directly display messages from the web application queue in InWorkBeeQueue using Apache Camel routes.

+2
source share

All Articles