- 03 May 2022
- 4 Minutes to read
IBM MQ Message Services
- Updated on 03 May 2022
- 4 Minutes to read
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.
- 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.
This example demonstrates how to configure the IBM MQ module and build a Message Handler Flow.
- Navigate to System > Settings. Right-click on IBM MQ Settings and select Edit.
- Enter the appropriate configuration details on the Edit IBMMQSettings window and click SAVE.
- Right-click on IBM MQ Settings. Select Control and select Start Queues to verify the connection.
- 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.
- 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.
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.
- 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.
- 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.
- 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.
- 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.
- Click the Done path on the Get String From UTF 8 Bytes step and select the Show Popup step. Then, click ADD.
- 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.
- Connect the Done path of the Show Popup step to the End step. Then, click Save and close the Flow Designer.
- Click SAVE on the Add Message Handler window.
- Create a Flow in a Designer Project. Add the Get UTF 8 Bytes From String step. Enter "test message" in the str field.
- Click the Done path and navigate to Integrations > All Integrations > Message Queues. Select the Post Message step and click ADD.
- 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.
- 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.
- 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.