Skip to main content

Using WebSphere ESB with WebSphere MQ to support publish/subscribe messaging - Middleware News

The Service Component Architecture (SCA) framework provides three different types of bindings to choose from for SCA import:
  • MQ Binding
  • MQ JMS Binding
  • JMS Binding
WebSphere ESB, by virtue of its underlying WebSphere Application Server components, supports publish/subscribe messaging implemented using the default messaging provider. While this article does not use that scenario, it explains the steps needed when you already have WebSphere MQ as the underlying messaging provider. WebSphere MQ V7 or later provides out-of-the-box support for publish/subscribe messaging.
This article shows you how to use the WebSphere MQ JMS binding to implement publish/subscribe messaging for seamless integration of events and data. The steps in this article will work on WebSphere MQ V7 or later and WebSphere ESB V6.2 or later.
The example below uses a simple customer order business object . The diagram shows the overall scenario. A real-world scenario might have MQ Export and MQ-JMS Import in separate modules, and a more complex object structure. The goal here is to show how MQ-JMS binding helps implement publish/subscribe messaging.
You can download the complete working solution at the bottom of the article. You will still need to complete the prerequisite steps below if you download and test the module. The CustomerOrder business object (BO) used in this article looks like this:

Prerequisite steps

Complete the following steps before starting the development:
  1. Make sure that WebSphere MQ is running. If the default configuration was created when WebSphere MQ was installed, you might already have a queue manager created. If not, create a new queue manager.
  2. Create three local queues as shown below:
  3. Create a Topic named TMS.CUSTOMERORDER with Topic String TMS/CUSTOMERORDER/#:
  4. Create the following two subscriptions to the topic, where the endpoints are the two queues defined in Step 2:
  5. Make sure the WebSphere ESB server is running and log in to the Administrative Console using the admin user ID.
  6. Select Resources => JMS => Topic connection factories:
  7. Click New and provide the details as shown below:
    • Make sure that Transport selected is Client. Bindings type does not work with a local queue manager (coexisting on the same server as WebSphere ESB).
    • Make sure that the WebSphere MQ messaging provider is selected:
  8. Click OK and save the configuration
  9. Select Resources => JMS => Topics:
  10. Click New and provide the information as shown below:
  11. Make sure that the Topic String defined while setting up the Topic in WebSphere MQ is used to specify the Topic Name in the above step.

Developing the solution

  1. Create a new Mediation Module project named MQPubSubModule. In actual project scenarios, you will create a new library and create the BOs and interfaces inside the library for better modularization. Since this is a demo, the necessary artifacts are created directly in the mediation module.
  2. Define a new BO named CustomerOrder:
  3. Define a new interface named CustomerOrderService with only one operation -- a one-way operation to demonstrate the publish/subscribe scenario:
  4. Select the defined BO as input while defining the interface.
  5. Open the assembly diagram.
  6. Drag and drop MQ binding from the Inbound Exports drawer onto the canvas.
  7. Specify the following properties while configuring the MQ Export. The screenshots below show the details after the MQ Export is completely configured. You provide the values shown below while configuring the MQ Export wizard:
    1. Select the Interface defined earlier:
    2. Specify the Bindings as shown below:
    3. Specify the Endpoint Configuration as shown below. Values for your environment may be different. Make sure that the Transport is Client and that Enable connection at startup is checked:
    4. For Method Binding, select UTF8XMLHandler:
    5. Keep Security Attributes as blank:
    6. The final Summary page should look like this:
    7. This sample uses the Specify properties option while configuring MQ Export
  8. MQ Import supports only the point-to-point model, and therefore this example uses MQ JMS Import to demonstrate the publish/subscribe messaging model.
  9. Drag and drop MQ JMS binding from Outbound Imports drawer on to the canvas.
  10. Specify the following properties while configuring the MQ JMS import. The screenshots below show the details after the MQ JMS import is completely configured. You provide the values shown below while configuring the MQ JMS Import wizard.
  11. In actual projects, the interface on MQ Export and MQ JMS Import may be different, and you may need to use a mediation flow in between to map source to target. To keep things simple, this example assumes that the export and import use the same interface.
    1. Select the interface defined earlier:
    2. Specify the Bindings details as shown below:
    3. Specify the Endpoint Configuration details as shown below. Use the already configured JNDI details:
    4. Specify the Method Bindings as shown below:
    5. Keep the Security Attributes empty and leave the message configuration as-is. The Summary screen should like this:
  12. Wire the export to the import, which adds the following entry on the MQ Export:
  13. Deploy the mediation module to the WebSphere ESB server

Testing the solution with WebSphere MQ Explorer

  1. Open WebSphere MQ Explorer if it is not already open.
  2. Connect to the queue manager on which the queues are defined.
  3. Right-click on the CUSTOMERORDER.NOTIFY queue and select Put test message:
  4. Use the following XML message for testing:
    
    C1000
    O1000
    P1000
    10
    3.14167
    
  5. Make sure that the line breaks are removed before placing the message on the queue:
  6. Click Put message.
  7. Close the window and click Browse on either of the two destination queues.
  8. The Message Data window shows the following details:
  9. Double-click on any message and click on Data on the window that opens:
  10. Copy and paste the data from the Message data field into a text editor. The response should look like this:
    
      
    C1000
    O1000
    P1000
    10
    3.14167
    
    

Conclusion


This article showed you how to use MQ Export and MQ-JMS Import bindings to implement publish/subscribe messaging using the underlying WebSphere MQ platform.

Comments

  1. This article is very much helpful and i hope this will be an useful information for the needed one.Keep on updating these kinds of informative things Biztalk online training hyderabad

    ReplyDelete

Post a Comment

adsrerrapop

Popular posts from this blog

IBM Websphere MQ interview Questions Part 5

MQ Series: - It is an IBM web sphere product which is evolved in 1990’s. MQ series does transportation from one point to other. It is an EAI tool (Middle ware) VERSIONS:-5.0, 5.1, 5.3, 6.0, 7.0(new version). The currently using version is 6.2 Note: – MQ series supports more than 35+ operating systems. It is platform Independent. For every OS we have different MQ series software’s. But the functionality of MQ series Default path for installing MQ series is:- C: programfiles\BM\clipse\SDK30 C: programfiles\IBM\WebsphereMQ After installation it will create a group and user. Some middleware technologies are Tibco, SAP XI. MQ series deals with two things, they are OBJECTS, SERVICES. In OBJECTS we have • QUEUES • CHANNELS • PROCESS • AUTHENTICATION • QUERY MANAGER. In SERVICES we have LISTENERS. Objects: – objects are used to handle the transactions with the help of services. QUEUE MANAGER maintains all the objects and services. QUEUE: – it is a database structure

IBM Websphere MQ Reason code list / mq reason codes / websphere mq error codes / mq error messages

Reason code list ================= The following is a list of reason codes, in numeric order, providing detailed information to help you understand them, including: * An explanation of the circumstances that have caused the code to be raised * The associated completion code * Suggested programmer actions in response to the code * 0 (0000) (RC0): MQRC_NONE * 900 (0384) (RC900): MQRC_APPL_FIRST * 999 (03E7) (RC999): MQRC_APPL_LAST * 2001 (07D1) (RC2001): MQRC_ALIAS_BASE_Q_TYPE_ERROR * 2002 (07D2) (RC2002): MQRC_ALREADY_CONNECTED * 2003 (07D3) (RC2003): MQRC_BACKED_OUT * 2004 (07D4) (RC2004): MQRC_BUFFER_ERROR * 2005 (07D5) (RC2005): MQRC_BUFFER_LENGTH_ERROR * 2006 (07D6) (RC2006): MQRC_CHAR_ATTR_LENGTH_ERROR * 2007 (07D7) (RC2007): MQRC_CHAR_ATTRS_ERROR * 2008 (07D8) (RC2008): MQRC_CHAR_ATTRS_TOO_SHORT * 2009 (07D9) (RC2009): MQRC_CONNECTION_BROKEN * 2010 (07DA) (RC2010): MQRC_DATA_LENGTH_ERROR * 2011 (07DB) (RC2011): MQRC_DYNAMIC_Q_NAME_ERROR * 2012 (07DC) (RC201

IBM WebSphere MQ – Common install/uninstall issues for MQ Version on Windows - Middleware News

Creating a log file when you install or uninstall WebSphere MQ WebSphere MQ for Windows is installed using the Microsoft Installer (MSI). If you install the MQ server or client through launchpad , MQPARMS or setup.exe , then a log file is automatically generated in %temp% during installation. Alternatively you can supply parameters on the installation MSI command msiexec to generate a log file, or enable MSI logging system-wide (which generates MSI logs for all install and uninstall operations). If you uninstall through the Windows Add/Remove programs option, no log file is generated. You should either uninstall from the MSI command line and supply parameters to generate a log file, or enable MSI logging system-wide (which generates MSI logs for all install and uninstall operations). For details on how to enable MSI logging, see the following article in the WebSphere MQ product documentation: Advanced installation using msiexec For details on how to enable system-w