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:
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.
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:
<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">
<bean id="service" class="org.apache.camel.example.service.Reporting"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<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>
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.