MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  DB2 insert trigger to MQ publish

    Posted Thu September 10, 2020 02:12 PM
    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
    ------------------------------


  • 2.  RE: DB2 insert trigger to MQ publish

    Posted Thu September 10, 2020 04:07 PM

    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






  • 3.  RE: DB2 insert trigger to MQ publish

    Posted Fri September 18, 2020 02:32 PM
    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
    ------------------------------



  • 4.  RE: DB2 insert trigger to MQ publish

    Posted Fri September 18, 2020 03:23 PM

    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






  • 5.  RE: DB2 insert trigger to MQ publish

    Posted Fri September 18, 2020 03:32 PM
    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
    ------------------------------



  • 6.  RE: DB2 insert trigger to MQ publish

    Posted Mon September 21, 2020 06:30 AM
    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.html

    Enables 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
    ------------------------------



  • 7.  RE: DB2 insert trigger to MQ publish

    Posted Mon September 21, 2020 06:17 AM
    Hirschel,
    Just for completeness.... Yes, someone "has written a MQ Client which runs on the z/OS mainframe".  That someone is called.... IBM.  If you're running Java on a J2EE platform (eg. WebSphere z/OS), then the MQ calls run just fine in MQ Client (or MQ Server) mode).  I believe that this was a requirement in order for the IBM J2EE platform (WAS) to be compliant.  And I seem to recall that Java running under CICS also added this ability to use MQ Client access a few years ago.

    ------------------------------
    Carl Farkas
    ------------------------------