title: Camel Load balancing example using Mina with Java DSL
body: <p>So, recently I started learning Camel. As part of the process I decided to go through all the examples (listed <a href="http://camel.apache.org/examples.html" rel="nofollow">HERE</a> and available when you <a href="http://camel.apache.org/download.html" rel="nofollow">DOWNLOAD</a> the package with all the examples and docs) and to see what I could learn. </p>
  
  <p>One of the examples, <a href="http://camel.apache.org/loadbalancing-mina-example.html" rel="nofollow">Load Balancing using Mina</a> caught my attention because it uses a Mina in different JVM's and it simulates a load balancer with round robin. </p>
  
  <p>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?</p>
  
  <p>My second question is code related. The description states, and I quote:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>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?</p>
  
  <p>The MINA-1 server code presented here:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:camel="http://camel.apache.org/schema/spring"
         xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
  
    &lt;bean id="service" class="org.apache.camel.example.service.Reporting"/&gt;
  
    &lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
  
      &lt;route id="mina1"&gt;
        &lt;from uri="mina:tcp://localhost:9991"/&gt;
        &lt;setHeader headerName="minaServer"&gt;
          &lt;constant&gt;localhost:9991&lt;/constant&gt;
        &lt;/setHeader&gt;
        &lt;bean ref="service" method="updateReport"/&gt;
      &lt;/route&gt;
  
    &lt;/camelContext&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>I don't understand how the <code>updateReport()</code> 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?)</p>
  
  <p>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.</p>