On this page, we are going to reconfigure Camel to send messages to the JBI endpoints we've just created
MyCamelRoute
classIf you look at the code below, it might come as no surprise that the only thing you need to know to interact with the JBI services is a specific URI syntax to refer to these services.
Let's first look in a bit more detail at the Camel route that sends data to the JBI endpoint:
timer://...
endpoint from the previous pagesjbi:endpoint:<namespace>:<service>:<endpoint>
, so for our JMS consumer endpoint this becomes jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider
If you specify your namespace as xmlns:ns="http://servicemix.apache.org/tutorial/camel"
instead of using the urn:
-style we are using in this tutorial, this slightly changes the JBI URI in Camel as well, as it would use the '/' as a separator. Example: jbi:endpoint://http
://servicemix.apache.org/tutorial/camel/jms/provider
For more information see the Camel JBI URI reference
consumer
on a service jms
in namespace org:apache:servicemix:tutorial
on the ESB. Because this matches the external JMS consumer endpoint we created on the previous page, this route will receive the messages from this external endpoint.log:
endpoints, we just use the Logger component to print out the message to the console.Just run the Maven build again and redeploy the JBI SA to test your changes to the Camel RouteBuilder. After deployment, you should start seeing these kind of messages in your ServiceMix console:
This clearly shows you the Type Converters in action: the same message is printed as the original NormalizedMessage, a DOMSource and a plain String.
Now that we know how to integrate Camel with the JBI ESB, there is something else we can investigate: Camel itself also has a lot of optional components that you can use inside ServiceMix. Let us have a look at how to go about this on the next page.
jbi:
URI, which only specifies the service name instead of service and endpoint. For more information on the JBI endpoint URIs, have a look at http://activemq.apache.org/camel/jbi.html