The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Forums
Ask questions and gain insight from discussions

How to implement a generic MQSeries message router in BusinessWorks - how to read from multiple queues from the same BusinessWorks process


Recommended Posts

Posted

To implement a generic MQSeries message router in BusinessWorks you need to be able to read messages from different queues in the same generic process. This cannot be done by using the standard 'Listen' activity while this activity is using the MQSeries API that can read message from only one queue at a time and doesn't support wildcarding for queue names.

The solution is to use the MQSeries trigger mechanism, the approach to build a generic message router is then the following :

. All queues that need to be managed in a generic manner (in other words by the message router) have to be defined with an MQSeries trigger

. When a message is received on one of those queues a notification (called a 'trigger message' in MQSeries) containing the name of the queue is put in a generic queue (called an initiation queue in MQSeries)

. A BusinessWorks application is Listening on the generic queue to process the notification messages and use the data from those messages (including the name of the queue that received the new message) to read messages from this queue using the MQ GET Activity

 

Creation of an initiation queue (using the MQSeries tool runmqsc) :

DEFINE QLOCAL (initiation.queue) REPLACE LIKE (SYSTEM.DEFAULT.INITIATION.QUEUE) DESCR ('the initiation queue')

Creation of two queues with a trigger :

DEFINE QLOCAL (Q1) REPLACE LIKE (SYSTEM.DEFAULT.LOCAL.QUEUE) INITQ (initiation.queue) PROCESS (process.name) TRIGGER TRIGTYPE (FIRST) TRIGMPRI(0)

DEFINE QLOCAL (Q1) REPLACE LIKE (SYSTEM.DEFAULT.LOCAL.QUEUE) INITQ (initiation.queue) PROCESS (process.name) TRIGGER TRIGTYPE (FIRST) TRIGMPRI(0)

Definition of a process (not used but needed by MQ Series):

DEFINE PROCESS (process.name) REPLACE DESCR ('process description') APPLICID (TEST.EXE) APPLTYPE (WINDOWS) USERDATA (TEST)

Tests just with MQ Series :

- Launch the default trigger monitor application on the initiation queue (an application must be listening on the initiation queue for the trigger to work):

- Start runmqtrm -q initiation.queue from MQSeries bin directory

- Put a message in Q1 or Q2 using MQExplorer (or 'amqsput')

- The trigger monitor application should detect the reception of the message and display an error message (because the TEST.EXE program doesn't exists)

Development of a BusinessWorks application processing messages in a generic way :

- Use 'Listen' activity to read message from the 'initiation.queue'

- Parse the trigger message structure using Parse COBOL Copy Book activity (the message format is defined as a Copy Book)

- Read the name of the queue that received the message from the output of the Parse Copy Book activity

- Read the message to process from the queue using 'GET' activity

Tests with BusinessWorks

- Put a message in Q1 or Q2 using MQExplorer (or 'amqsput')

- Messages from Q1 and Q2 are read by the generic BusinessWorks process

Failure management

- In case of failure of the queue manager or the BusinessWorks application a trigger message is put in the initiation queue for all queues that have pending messages at the time of the restart (one trigger message per queue). With this mechanism there is no loss of message in case of a failure, note that in the case of a failure many messages can be present in a queue and a single trigger message will be sent, it is then needed to loop over messages until they all have been processed in the generic process.

Useful links :

https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev....

https://www-01.ibm.com/support/docview.wssuid=swg27015657&aid=1

https://mqtechconference.com/sessions_v2014/MQ_Triggering.pdf

https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev....

https://www-01.ibm.com/support/docview.wssuid=swg27041673&aid=1

https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev....

Trigger message format :

https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev....

https://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref....

 

The above is valid for #BW5X and #BW6X

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...