Himanshu Yadav
Himanshu Yadav

Reputation: 13585

Using Apache Camel for Load Balancing

Can I access SEDA or VM queue from another machine or JVM?
I actually want to implement load balancing with the help of Camel but do not want introduce another messaging framework for this. I just want to distribute load to different consumers from a producers using some in built queue.
Is it possible? If no then what are my options?
Another Approach:(Pull Approach) Not sure how optimum new approach is or what are the advantages and disadvantages of new approach, So please help me to analyze this approach.
Messages will be put into a Master queue and all the worker systems will be listening to Master queue.Let's say 100,000 messages are being put into Master queue and 5 worker systems are listening to it. Worker systems will process the messages one by one from the master queue. There are two big benefits with this approach:

  1. I don't need to worry about registering my worker systems with the producer. Sixth system just boot up and start listening to Master queue.
  2. I don't need to worry about sending message to a consumer system which is free. When worker system will be done processing a message, it pick up another one from the Master queue.
    Let me know your thoughts on it.

Upvotes: 2

Views: 1188

Answers (3)

Henryk Konsek
Henryk Konsek

Reputation: 9168

SEDA and VM:// work only on the same JVM.

Load balancing in Java messaging is usually achieved using the JMS and Competing Consumers pattern. You send messages to the queue and multiple consumers compete to process them.

If broker with its queue becomes a bottleneck - consider using fan-out pattern and the network of brokers.

Upvotes: 2

Christian Schneider
Christian Schneider

Reputation: 19626

The easiest way is to use jms. If you have n routes listening on the same jms queue then they will automatically load balance. If one goes away the load will be balanced over the remaining ones. I recommend starting with ActiveMQ as it is very easy to setup and well integrated with Camel.To make the broker highly available you can either setup two standalone brokers or setup one embedded broker per camel instance.

Upvotes: 1

sully6768
sully6768

Reputation: 2517

SEDA and VM endpoints are valid for the host Context and JVM respectively. To facilitate JVM-to-JVM messaging you will need to use an over-the-wire protocol component such as, but not limited to, Mina, HTTP or JMS.

Upvotes: 2

Related Questions