IBM MQ Message Services
  • 03 May 2022
  • 4 Minutes to read
  • Dark
    Light

IBM MQ Message Services

  • Dark
    Light

Overview

IBM Message Queue (IBM MQ) is an enterprise-grade messaging system for application-to-application communication.  The IBM MQ Module allows Flows built-in Decisions to work messages. Users can also push messages to queues using a basic Flow step. Decisions integrates with IBM MQ and can take in a message and then convert the message to any type of data for processing.

Prerequisites
The following is required before integration with IBM MQ can occur:
  • A preexisting IBM MQ Account.
  • Proper installation and set up of an IBM MQ application.
  • Proper installation and set up of IBM MQ Module in Decisions.
  • IBM WebSphere MQ Explorer configured

    For more information on how to install Modules in Decisions, see: Installing Modules.


Example

This example demonstrates how to configure the IBM MQ module and build a Message Handler Flow.

  1.  Navigate to System > Settings. Right-click on IBM MQ Settings and select Edit.
  2. Enter the appropriate configuration details on the Edit IBMMQSettings window and click SAVE.
  3. Right-click on IBM MQ Settings. Select Control and select Start Queues to verify the connection.
  4. Navigate to System > Jobs and Events > Message Queues. On the Global Action Bar, click ADD IBM MESSAGE QUEUE and enter the Display Name and Queue. Then, click SAVE.
  5. Navigate to System > Jobs and Events > Message Queue Handlers. Click ADD MESSAGE HANDLER. Provide a name for the Handler and select the appropriate Message Queue. 

    Configuration options

    • Handler Name: The name to display in Decisions.
    • Message Handling: Lease the Message (lock), lease the Message temporarily (lock with auto timeout), remove it after processing (pop), or use it but leave it on the Queue (peek).  
      • Get: Reads messages from the Message Server and tells the Message Server that they have been handled. The Message Server removes them from its message queue. This mode instructs the relevant message server or third-party client to pull messages off of the Message Server as fast as possible and keep them in an in-memory list for Decisions to pull from.

      • Lease: Reads messages from the Message Server and tells the Message Server that they are being processed, this is used when every message must be handled. The Message Server keeps them in the queue, marking them as "leased" by a client (that is, Decisions), and does not deliver them to any other client that requests messages from the queue. When Decisions finishes handling the message by running the handler flow, it tells the Message Server that the message has been handled and the Message Server marks it for deletion. If Decisions doesn't do this (for example, if the handler flow encountered an error), then the lease on that message will eventually timeout and the Message Server will mark it as deliverable to another client.

    • Active Flow Count: Maximum number of simultaneous Messages that Decisions will process.
    • Handler Flow: The Flow used to process Messages that appear in the Queue. 
    • Message Queue: The Queue for the Handler to listen on, that was configured in System Settings.



    Lease Mode is slightly slower than Get modes but doesn't have the problem where Messages can be lost in memory prior to being processed if the Decisions server shuts down or gets rebooted.
  6. Select PICK HANDLER FLOW and click CREATE. Select Message Queue Handler Flowand name the Flow. Then, click CREATE.
    Learn more about Message Handler Flows using Message Handler Flows article. Building a Message Handler Flow will require different steps depending on the contents of the message that is being formatted. Each format whether it be a simple text, XML or JSON has different steps that extract the contents of the message. After choosing the correct step for the message, build the Flow to react to the contents.



  7. Click the Done path on the Start step and navigate to All Steps [Catalog] > Data > Text. Select the Get String From UTF 8 Bytes step and click ADD.
  8. With the step selected, click Unknown under the INPUTS category on the Properties panel and select Select From Flow. Click Message and select Payload. Click DONE.
  9. Click the Done path on the Get String From UTF 8 Bytes step and select the Show Popup step. Then, click ADD.
  10. On the Properties panel, enter "notification" in the Subject field. Click Unknown next to the Message field and select Select From Flow. Select Get String from UTF 8 Bytes_ Output and click DONE.
  11. Connect the Done path of the Show Popup step to the End step. Then, click Save and close the Flow Designer.
  12. Click SAVE on the Add Message Handler window.


Debug

  1. Create a Flow in a Designer Project. Add the Get UTF 8 Bytes From String step. Enter "test message" in the str field.
  2. Click the Done path and navigate to Integrations > All Integrations > Message Queues. Select the Post Message step and click ADD.
  3. Select the appropriate Queue Name from the dropdown menu. Select the checkbox under Always Override Id (Even If Null or Empty). Select Unknown Next to Message Body and click Select From Flow. Select GetUTF8BytesFromString1_Output and click DONE. Select Ignore next to Override Message Id and click Null. Connect the Done path to the End step.

    When utilizing IBM MQ Message Services, it is best to let the server determine the message Id; the Always Override Id (Even if Null or Empty) setting allows IBM MQ to decide on a Message Id. Users should avoid setting their own custom Message Id. 


  4. Select Debug from the top action bar and click START DEBUGGING. This Flow will post a message to the Message Queue, alerting the Message Handler and triggering it to show a notification. The message will also be visible in the queue from the IBM Explorer.
  5. Create a new Flow and add a Get String Message step to the Done path of the Start step. Select the appropriate queue from the Queue Name field in the Properties panel. Connect the Done and End Message to the End step. Save the Flow.



IBM MQ messaging Queues can be further tested by utilizing the Queue Control options.  Right-click the Message Queue and navigate to Control and select Start Queue. This option will in turn run the queue and use the Message Queue Handler Flow to determine how to interact with IBM MQ.  If the Queue Handler works successfully, the assigned account will receive a Pop Up Notification. 



Was this article helpful?

What's Next