Now it is time to practice the things you have learned.

Introducing the protocol bridge example

The protocol bridge example that is included with the distribution is a service assembly that:

  • receives an HTTP request
  • transforms the message using XSL-T
  • and sends it to a JMS queue

Exercise

Deploy the service assembly

The service assembly for this application is available in the distribution as <servicemix_home>/examples/bridge/bridge-sa-<version>.zip. Just deploy this service assembly on ServiceMix now (If you don't remember how to deploy a service assembly, take a look at 1.4. Beginner - Running the wsdl-first example).

However, the console output seems to indicate that something is not right with this service assembly. Can you figure out what is happening?

INFO  - AutoDeploymentService          - Directory: deploy: Archive changed: processing bridge-sa-<version>.zip ...
WARN  - AutoDeploymentService          - Components servicemix-jms, servicemix-saxon, servicemix-eip are not installed yet: 
                                         the service assembly bridge-sa deployment is suspended and will be resumed once the listed components are installed
INFO  - AutoDeploymentService          - Directory: deploy: Finished installation of archive:  bridge-sa-<version>.zip

Components

ServiceMix tells you to install additional components. This example requires additional features from the ESB: some of the service units we want to deploy target components that have not been installed yet. In order to continue,you will need to install these additional JBI components:

  • servicemix-jms will allow ServiceMix to send and receive JMS message
  • servicemix-saxon provides support for XSL-T and XQuery
  • servicemix-eip provides support for some Enterprise Integration Patterns

Go ahead and install these components now. Refer back to 1.3. Beginner - About components if necessary. If all goes well, your console should show this output

INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-jms-<version>-installer.zip ...
INFO  - ComponentMBeanImpl             - Starting component: servicemix-jms
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-jms
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-jms-<version>-installer.zip
INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-eip-<version>-installer.zip ...
INFO  - ComponentMBeanImpl             - Starting component: servicemix-eip
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-eip
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-eip-<version>-installer.zip
INFO  - AutoDeploymentService          - Directory: install: Archive changed: processing servicemix-saxon-<version>-installer.zip ...
INFO  - ComponentMBeanImpl             - Starting component: servicemix-saxon
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-saxon
INFO  - ServiceAssemblyLifeCycle       - Starting service assembly: bridge-sa
INFO  - ServiceUnitLifeCycle           - Initializing service unit: bridge-http-su
INFO  - ServiceUnitLifeCycle           - Initializing service unit: bridge-eip-su
INFO  - ServiceUnitLifeCycle           - Initializing service unit: bridge-xslt-su
INFO  - ServiceUnitLifeCycle           - Initializing service unit: bridge-jms-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: bridge-http-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: bridge-eip-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: bridge-xslt-su
INFO  - ServiceUnitLifeCycle           - Starting service unit: bridge-jms-su
INFO  - AutoDeploymentService          - Directory: install: Finished installation of archive:  servicemix-saxon-<version>-installer.zip

Not only does the logging show you that ServiceMix started the three components you just installed, it also continued the deployment of the bridge-sa-<version>.zip service assembly automatically. If you point your browser at http://localhost:8192 now, you should see that the additional service is now also available.

Testing and verifying the result with JMX

You can now go ahead and test this service assembly. The distribution also comes with an HTML page to help you test this service assembly. You find this page in <servicemix_home>/examples/bridge/client.html. If you click the send button in the left side of the page, you should get an message STATUS: 202 in the right side, indicating that the request has completed successfully.

The message has been sent to ActiveMQ, the embedded JMS server in ServiceMix. If you connect to ServiceMix using JMX, you can also use the MBean view to navigate to the ActiveMQ Queue information. The attributes for the bridge.output queue show the number of messages that have been received by this queue. Verify that the queue has received your message.

While you are using the JMX console, try to find the JBI components and service assembly you have just installed in there. We have learned how to do so in 1.5. Beginner - Using JMX to look inside the ESB.

Further reading