Mule ESB with the Oracle Database and IBM WebSphere MQ – Use case 3 of 3

motif

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_3.4.0.201304102100/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_3.4.0.201304102100/mule/user.
  • cp /opt/mqm/java/lib/dhbcore.jar
    /home/mule/Mule-3.4/MuleStudio/plugins/org.mule.tooling.server.3.4.0.ee_3.4.0.201304102100/mule/user.

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.

Summary

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/.

Setup Steps

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
  • Create a Queue named QUEUE1.
    • runmqsc QMA
    • DEFINE QLOCAL(QUEUE1)
  • Verify in MQ Explorer that you can access QUEUE1 .

 


We'd love to hear your opinion on this post


5 Responses to “Mule ESB with the Oracle Database and IBM WebSphere MQ – Use case 3 of 3”

  1. Part-3 needs to be looked at following points
    1. I am using home premium. I don’t see any domain name while installing WMQ. So do I need to give channel name, user and pc?
    2. I see Object to XML. Which generated class should I specify?
    3. If the above are added, it would be complete and helpful for new Mulers.

    • Siva,
      1. You need to run additional steps to set up the MQ Channel, Listener as follows. (note, ‘mule’ is my Linux OS user, just replace with yours). Then you can use the host name localhost, port 1414, channel name CHANNEL1 and your username.

      runmqsc QMA

      SET AUTHREC PROFILE(QUEUE1) OBJTYPE(QUEUE) PRINCIPAL(‘mule’) AUTHADD(PUT,GET,DSP)
      SET AUTHREC OBJTYPE(QMGR) PRINCIPAL(‘mule’) AUTHADD(CONNECT,INQ,DSP)
      SET AUTHREC PROFILE(SYSTEM.MQEXPLORER.REPLY.MODEL) OBJTYPE(QUEUE) PRINCIPAL(‘mule’) AUTHADD(DSP,INQ,GET)
      SET AUTHREC PROFILE(SYSTEM.ADMIN.COMMAND.QUEUE) OBJTYPE(QUEUE) PRINCIPAL(‘mule’) AUTHADD(PUT,INQ)
      DEFINE CHANNEL(CHANNEL1) CHLTYPE(SVRCONN) TRPTYPE(TCP)
      DEFINE LISTENER(LISTENER1) TRPTYPE(TCP) CONTROL(QMGR) PORT(1414)
      START LISTENER(LISTENER1)
      ALTER QMGR CHLAUTH(DISABLED)
      END

      2. You can leave it with the default (blank), its going to generate the XML based on the Object structure.
      3. Thanks for the feedback!

  2. Much appreciative. Nice article. Keep us posted on managing in Clusters under tomcat servers please.

  3. Nice article. Do you have more information for best practices around using real time API’s like from Sales Force and large data sets?