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:

  • A Client Application which simulates an external application submitting the original PackingSlip to the processor service (dynamicQueues/demo.process queue)
  • The Processor Service which contains the logic to check the PackingSlip and route it to the MagooClient queue for editing if required. For demo purposes, the Service is ‘hard-wired’ to route all received PackingSlips to MagooClient (dynamicQueues/demo.rectify queue)

 

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:

  • A top-level Ant build.xml and associated README.txt files
  • A src directory containing simple demo Java source code for the service implementation and a client application to initially send a processPackingSlip message to the service.
  • A wsdl directory containing the MagooLogistics.xsd types schema and two WSDL files , MagooLogisticsApacheCXF_2_0_1.wsdl and MagooLogistics.wsdl, containing the service definition.

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:

  • a RectifyToProcess.xsl transform which converts a rectifyPackingSlip to a processPackingSlip message. This is used when replying within MagooClient to ensure that the correct message format is used when re-submitting back to the service.
  • XSL stylesheets and scripts required to render the messages in a more user-friendly format within MagooClient.

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.

1 2 3 4 5 Next >