Before we can learn about accessing other services on the JBI ESB, we have to
Excerpt |
---|
add a JMS SU with two endpoints to interact with |
.
Adding a JMS SU
Creating the JMS SU
You can create the JMS SU by using the Maven archetype for it in your project's root:
No Format |
---|
mvn archetype:create -DarchetypeArtifactId=servicemix-jms-provider-service-unit
-DarchetypeGroupId=org.apache.servicemix.tooling -DartifactId=tutorial-camel-jms-su
|
Adding the JMS SU to our SA
To do this, just add the SU as a dependency to your SA's pom.xml:
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<dependencies>
...
<dependency>
<groupId>org.apache.servicemix.tutorial.camel</groupId>
<artifactId>tutorial-camel-jms-su</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
...
</project>
|
Info |
---|
title | If you are using Eclipse |
---|
|
If you are using Eclipse for taking this tutorial, you should take a minute at this point to re-run mvn eclipse:eclipse , import the additional SU project into the workspace and refresh the SA project to get back in sync with your Maven project. |
Configuring the JMS SU
Now, modify the JMS SU's xbean.xml to configure a sample consumer and provider endpoint, both referring to the same queue like this:
Code Block |
---|
|
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:tutorial="urn:org:apache:servicemix:tutorial:camel"
xmlns:amq="http://activemq.org/config/1.0">
<jms:provider service="tutorial:jms"
endpoint="provider"
destinationName="tutorial.camel.queue"
connectionFactory="#connectionFactory" />
<jms:consumer service="tutorial:jms"
endpoint="consumer"
destinationName="tutorial.camel.queue"
connectionFactory="#connectionFactory"
targetService="tutorial:jms"
targetEndpoint="consumer" />
<amq:connectionFactory id="connectionFactory" brokerURL="tcp://localhost:61616" />
</beans>
|
Build and deploy the SA
Just to make sure you haven't made any mistakes here, quickly build and deploy the SA again now. Feel free to connect to ServiceMix using a JMX console to convince yourself that the new endpoints are actually available. Leave the JMX console running for now, you'll be needing it in our next step as well.
![](/confluence/download/thumbnails/77035/jmx_check_endpoints.png?version=1&modificationDate=1203392547000&api=v2)
Now that we are done with preparations, it's time to get back to Camel and do something with our all new endpoints now.