In Part 1 of this three part blog, we created an HTTP REST service that retrieves employee records from an Oracle HR database and returns it in JSON format. In Part 2, we took a look at how to easily turn this into a SOAP XML service without any coding by utilizing the SOAP component for top-down web service generation and the Data Mapper for transformations. Let’s now publish the Employee Record as a message to WebSphere MQ, which is a common approach for integrating with legacy on-premise systems. (Note: Setup steps are at the end of each part for the necessary software. Parts 1 and 2 of this blog needs to be completed.)
Part 3: Publishing the message to a WebSphere MQ Queue.
Now, let’s add a WMQ end point to our flow to asynchronously publish a message to a WebSphere MQ Queue. To get started, we need to add the MQ Library JAR file to your Mule ESB’s lib/user directory. For Studio, this is the plugins/org.mule.tooling.server.3.4.0.ee_18.104.22.168304102100/mule/user directory under your MuleStudio installation directory. Copy the files from MQ’s java/lib starting with com.ibm.mq* and dhbcore.jar to this directory. For example:
- cp /opt/mqm/java/lib/com.ibm.mq* /home/mule/Mule-3.4/MuleStudio/plugins/org.mule.tooling.server.3.4.0.ee_22.214.171.124304102100/mule/user.
- cp /opt/mqm/java/lib/dhbcore.jar
Back in Mule Studio, add an Async scope to your message flow as shown:
Then, add a WMQ endpoint inside the Async flow.
Double-click the WMQ endpoint and specify a Queue name of QUEUE1.
Click the References tab and add a Connector Reference by clicking the + icon.
Specify the connectivity information to your WebSphere MQ Queue Manager as shown:
Your complete flow should now look like this:
Run the previous SOAP UI test again then open MQ Explorer. You should now see a message in QUEUE1. Right-click QUEUE1 and select Browse Messages to see the XML message sent by Mule ESB.
As we’ve seen previously, it is very easy to create services with Mule Studio – whether plain HTTP Services with JSON or SOAP-based Web Services. It is also very easy to orchestrate existing on-premise systems like the Oracle Database and IBM WebSphere MQ as part a Mule message flow. In this 3 part blog, we were able to accomplish service creation, data transformation and service orchestration, all without any coding. Instead of coding, we made use of Mule ESB’s building blocks like the HTTP endpoint, the SOAP component, the Data Mapper, XML and JSON transformers and the WMQ endpoint to rapidly develop a flow. Mule ESB also provides several Cloud Connectors to allow you to orchestrate cloud-based systems like SalesForce.com along with your on-premise systems, which I’ll target for a future blog. That’s it for now. For more on Mule, check out: http://www.mulesoft.com/.
Part 1 and 2
IBM WebSphere MQ 7.5 Trial (optional – for part 3)
- Download and install IBM WebSphere MQ 7.5: http://www.ibm.com/developerworks/downloads/ws/wmq/
Setup a Queue Manage named QMA and start it up.
- crtmqm -q QMA
- strmqm QMA
- crtmqm -q QMA
Create a Queue named QUEUE1.
- runmqsc QMA
- DEFINE QLOCAL(QUEUE1)
- runmqsc QMA
- Verify in MQ Explorer that you can access QUEUE1 .