Integrating MagooClient with Apache ActiveMQ/CXF(1)
Introduction
This document is intended as a companion to the SuperLogistics document which outlines how MagooClient interacts with JMS-based SOA. This document provides a detailed description of how the SuperLogistics scenario can be implemented using Apache CXF/ActiveMQ. It is strongly recommended that you read through the introductory SuperLogistics document before working through this demo.
Scenario Overview
The demo architecture diagram is provided below for reference. In addition to MagooClient, there are two other partners within the message exchange scenario:
Requirements
The following must first be installed:
For the purposes of this demo, Apache ActiveMQ was unzipped to C:\apache-activemq-4.1.1 and Apache CXF to C:\apache-cxf-2.0.1-incubator. If alternative installation directories are used then build scripts and environment variables (particularly ACTIVEMQ_HOME) must be modified accordingly.
The user PATH must be set to include the Apache Ant bin to allow ant to be invoked from the command line.
MagooLogisticsApacheCXF_2_0_1 Zip
Download the MagooLogisticsApacheCXF_2_0_1.zip file from the Magoo Software website. This contains:
The demo is based on the jms_queue sample provided with Apache CXF and uses a derived build.xml to compile the code and run the client and server components. The build file also references the top-level common_build.xml file in the Apache CXF samples directory. Therefore extract the MagooLogisticsApacheCXF_2_0_1 directory to the samples directory under your Apache CXF installation before running ant.
MagooLogisticsForms Zip
The MagooLogisticsForms.zip file is shared across all implementations of the MagooLogistics blueprint. It contains:
The MagooLogisticsForms directory should be extracted to your MagooClient installation directory e.g. c:\Program Files\MagooSoft\MagooClient\MagooLogisticsForms
NOTE: the stylesheets reference scripts which are expected to be found in a MagooLogisticsForms directory under your MagooClient installation. If you use an alternative location for the MagooLogisticsForms artifacts then the stylesheets will need to be modified accordingly.
WSDL JMS Bindings
Apache CXF allows JMS destinations to be specified as the target address for service invocations. This is accomplished using the following two extensions to a ‘regular’ HTTP-oriented WSDL definition.
The first extension is the use of a JMS transport attribute on the WSDL Binding e.g.
transport=”http://cxf.apache.org/transport/jms”compared to the usual HTTP attribute
transport=”http://schemas.xmlsoap.org/soap/http”
The second is the use of a JMS extensibility element within the WSDL Port. For the Rectifier Service this looks like:
<wsdl:port binding="tns:RectifierBinding" name="RectifierPort">
<jms:address destinationStyle="queue"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/demo.rectify">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url”
value="tcp://localhost:61616"/>
</jms:address>
</wsdl:port>
Note that this includes not just the destination style (i.e. queue or topic) and the destination name but also connection details such as the connection factory name and JNDI settings. As we’ll see in later sections, the key pieces of information interpreted by the MagooClient WSDL processor are the destination style and name – the other details will be configured as part of the JMS transport set-up.
Note: Correct interpretation of the Apache CXF JMS transport attribute and JMS address extensibility elements requires MagooClient V3.5.1 or above.