I was spending time with DB2
enable_MQFunctions only once - that time MQ Server was installed on the DB2 instance.
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0010964.htmlEnables
Db2® WebSphere® MQ functions for the specified database and validates that the
Db2 WebSphere MQ functions can be executed properly. The command fails if WebSphere MQ and WebSphere MQ AMI have not been installed and configured.
The REST API will work, just message 3 might arrive before message 2.
Perhaps you also want to think about the bulk case when 100 records are getting inserted into the DB in the same second.
Putting them into the queue 1 by 1 may not be efficient.
------------------------------
Matthias Jungbauer
------------------------------
Original Message:
Sent: Fri September 18, 2020 03:32 PM
From: Jim Creasman
Subject: DB2 insert trigger to MQ publish
Sorry. I should have been clear. In my case DB2 is installed on a distributed system (Linux), not z/OS. I was hoping the DB2 MQ support would ship with the required client code.
I saw the REST API in the docs. I'll look at this as well.
Seems this may not be QED ;-).
Jim
------------------------------
Jim Creasman
Original Message:
Sent: Fri September 18, 2020 03:22 PM
From: hirschel wasserman
Subject: DB2 insert trigger to MQ publish
HI Jim
I don't believe that anyone has written a MQ Client which runs on the z/OS mainframe.
If there is one out there, I would sure like to know about it.
The MQSEND runs in 'bindings' mode, i.e. requires MQ install on the same z/OS lpar.
Another way (disclaimer: I have never tried it) might be to use some of the DB2 SOAP/REST functions inside of the Db2 trigger to invoke a webservice call.
Db2XML.HTTP<method>(url, httpheader <input>)
MQ supports a REST API interface to put/get messages to/from a queue.
https://host:port/ibmmq/rest/ve/messaing/qmgr/<you_qmgr>/queue/<your_queue>/message
Hirschel Wasserman
This email and any attachments are intended only for the named recipient and may contain confidential and/or privileged material. Any unauthorized copying, dissemination or other use by a person other than the named recipient of this communication is prohibited. If you received this in error or are not named as a recipient, please notify the sender and destroy all copies of this email immediately.
Insurance Corporation of British Columbia | 151 W. Esplanade | North Vancouver | V7M 3H9
Contact Us
Original Message:
Sent: 9/18/2020 2:32:00 PM
From: Jim Creasman
Subject: RE: DB2 insert trigger to MQ publish
Hirschel,
I've been looking into how to set this up. It seems that you need the MQ server installed on the same system where DB2 is installed in order to send to a local queue manager. Is that right? I was expecting to only need some MQ client installed on the DB2 server, not the full MQ server.
Thanks,
Jim
------------------------------
Jim Creasman
Original Message:
Sent: Thu September 10, 2020 04:07 PM
From: hirschel wasserman
Subject: DB2 insert trigger to MQ publish
Hi
Create a DB2 trigger which can invoke (directly or indirectly) the MQSEND stored procedure. QED.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hirschel Wasserman
This email and any attachments are intended only for the named recipient and may contain confidential and/or privileged material. Any unauthorized copying, dissemination or other use by a person other than the named recipient of this communication is prohibited. If you received this in error or are not named as a recipient, please notify the sender and destroy all copies of this email immediately.
Insurance Corporation of British Columbia | 151 W. Esplanade | North Vancouver | V7M 3H9
Contact Us
Original Message:
Sent: 9/10/2020 2:12:00 PM
From: Jim Creasman
Subject: DB2 insert trigger to MQ publish
I'm looking at a use case where I would like to add a message to a MQ queue whenever a new row is inserted into a DB2 table. The message content would include data from the new row. Is there any way to configure this to happen automatically from the DB2 side of things?
Thanks
------------------------------
Jim Creasman
------------------------------