camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <>
Subject Re: Load balancing using Mina example with Java DSL
Date Mon, 04 Nov 2013 01:54:40 GMT

The magic is happened in the camel-context-loadbalancer.xml.
The client is not tcp client, it is just a camel client which can send the request to direct:loadbalance
If you want to add third mina endpoint, you can modify the file of camel-context-loadbalancer.xml.

Willem Jiang

Red Hat, Inc.
Blog: ( (English)
 ( (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem

On Monday, November 4, 2013 at 5:42 AM, pmp.martins wrote:

> So, recently I started learning Camel. As part of the process I decided to go
> through all the examples (listed HERE
> <> and available when you DOWNLOAD
> <> the package with all the examples
> and docs) and to see what I could learn.  
> One of the examples, Load Balancing using Mina
> <> caught my
> attention because it uses a Mina in different JVM's and it simulates a load
> balancer with round robin.  
> I have a few problems with this example. First it uses the Spring DSL,
> instead of the Java DSL which my project uses and which I find a lot easier
> to understand now (mainly also because I am used to it). So the first
> question: is there a version of this example using only the Java DSL instead
> of the Spring DSL for the routes and the beans?
> My second questions is code related. The description states, and I quote:
> <blockquote cite="">
> Within this demo every ten seconds, a Report object is created from the
> Camel load balancer server.
> This object is sent by the Camel load balancer to a MINA server where the
> object is then serialized.
> One of the two MINA servers (localhost:9991 and localhost:9992) receives the
> object and enriches  
> the message by setting the field reply of the Report object. The reply is
> sent back by the MINA  
> server to the client, which then logs the reply on the console.
> </blockquote>  
> So, from what I read, I understand that the MINA server 1 (per example)
> receives a report from the loadbalancer, changes it, and then it sends that
> report back to some invisible client. Upon checking the code, I see no
> client java class or XML and when I run, the server simply posts the results
> on the command line. Where is the client ?? What is this client?
> In the MINA 1server code presented here:
> <code>
> <beans xmlns=""
> xmlns:xsi=""
> xmlns:camel=""
> xsi:schemaLocation="
> <bean id="service" class="org.apache.camel.example.service.Reporting"/>
> <camelContext xmlns="">
> <route id="mina1">
> <from uri="mina:tcp://localhost:9991"/>
> <setHeader headerName="minaServer">
> <constant>localhost:9991</constant>
> </setHeader>
> <bean ref="service" method="updateReport"/>
> </route>
> </camelContext>
> </beans>
> </code>
> I don't understand how the updateReport method magically prints the object
> on my console. What if I wanted to send message to a third MINA server? How
> would I do it? (I would have to add a new route, and send it to the URI of
> the 3rd server correct?)
> I know most of these questions may sound dumb, but I would appreciate if
> anyone could help me. A Java DSL version of this would really help me.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at (

View raw message