Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

In this exercise, you will have to excerptINLINE

add two service units and redeploy the service assembly by yourself

...

Introduction

Instead of simply copying files from one directory to the other, we are now going to send the message straight to a JMS queue. We also want to retain a copy of the original message for archiving, so we are going to use the wiretap pattern for that.

...

You can also use servicemix-camel instead of servicemix-eip to implement the wiretap pattern. Just omit the steps related to tutorial-eip-su and have a look at Replacing tutorial-eip-su with tutorial-camel-su to learn how to do this.

...

Change the tutorial-jms-su's xbean.xml to access a queue named queue/tutorial on ActiveMQ (which is embedded in ServiceMix).

...

...

Configure tutorial-eip-su

Change the tutorial-eip-su's xbean.xml to define the wiretap we need.

...

We want to forward the message exchange to the jms endpoint, so we specify that information on the first <eip:exchange-target/>. The second one refers back to the <file:sender/> endpoint we declared earlier.

...

You have to change the targetService on the <file:poller /> endpoint to refer to our newly created wiretap. Afterwards, it should like this:

...

Build and deploy

When everything is done, you are ready to build and deploy the service assembly. When you do the build, the log should be similar to this one (if the SA isn't built last, you forgot to add the necessary <dependency/> to that pom.xml file):

...

...

For the deploy, you have two ways :

  • you can deploy it directly using the JBI maven plugin No Format mvn jbi:projectDeploy -DforceUpdate=true
  • you can create the SA zip file and copy the SA zip file into the SERVICEMIX_HOME/hotdeploy directory No Format mvn install

Testing

If you copy a file into the poller's target directory now, it will also be moved into the sender's directory, just as before. However, there should also be a copy of the message in our JMS queue. To check this, connect to ServiceMix using a JMX console (refer back to our previous tutorial if you need help doing this) and navigate the MBean tree to org.apache.activemq/localhost/Queues. A queue should have been auto-created with the name queue/tutorial and the EnqueueCount attribute is showing the number of messages that have already been sent (in our case: 1).

...