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.  CorrelationID is not refreshed when using pub sub ?

    Posted Mon July 13, 2020 01:12 AM
    Hi,

    I am using this code to configure a pub sub and it goes like this:
    Message is send to Alias, Alias has as target a topic.  Subscription listen on topic and Subscriptions puts message on queue whether or not based on a selector. In this case not.

    #create topic string  /sligro/transactions/bpsligro
    DEFINE TOPIC('ESB.PARTNER_ADMINISTRATION_BP.TOP') +
       TOPICSTR('/sligro/transactions/bpsligro') DEFPSIST(YES) +
       REPLACE
     
    #create Alias with target topic above.
    DEFINE QALIAS('ESB.PARTNER_ADMINISTRATION_BP.ALS') +
            DEFPSIST(YES) +
           TARGET('ESB.PARTNER_ADMINISTRATION_BP.TOP') +
           TARGTYPE(TOPIC) +
           REPLACE
     
    # Error queue and backout queue for local queue
    DEFINE QLOCAL('ESB.PARTNER_ADMINISTRATION_BP.ERR') LIKE('TEMPLATE.SLIGRO_ORDERS.DEF') REPLACE
     
    # Create local queue with backout queue.
    DEFINE QLOCAL('ESB.PARTNER_ADMINISTRATION_BP.DAT') LIKE('TEMPLATE.SLIGRO_ORDERS.DEF') BOQNAME('ESB.PARTNER_ADMINISTRATION_BP.ERR') BOTHRESH(1) REPLACE
     
    # create subscription which is listening to topic and send message to the local queue 
    DEFINE SUB('ESB.PARTNER_ADMINISTRATION_BP.SUB') +
       TOPICSTR('/sligro/transactions/bpsligro') +
       DEST('ESB.PARTNER_ADMINISTRATION_BP.DAT') +
       DESTQMGR('QMAN_BA') +
         REPLACE
    REFRESH SECURITY

    If we put a message on the Alias queu, the CorrelationID never change, is this expected behaviour  ?
    How can we change this so that on every put a unique CorrelationID is generated ?
    Or maybe is it possible to switch off the creation of the CorrelationID ?

    About the process we use and why we can't use the correlation ID:
    We have a listening MQ client, which gets messages from the local queue.  This MQClient  uses the MQ correlationID as an unique identifier in a process.  We can't overide this setting and yes this is a bug in our MQClient but that doesn't solve the problem. But thats why we want to get rid of the correlationID or make it unique.

    Thanks

    ------------------------------
    Bernard Pittens
    Integration Engeneer
    Sligro Foodgroup B.V.
    Veghel
    ------------------------------


  • 2.  RE: CorrelationID is not refreshed when using pub sub ?
    Best Answer

    Posted Mon July 13, 2020 01:56 AM

    If you want to have the publishers correlation ID passed through to the subscriber, you should follow the instructions described here:

    IBM MQ Little Gem #31: Publisher's CorrelId

    Cheers,
    Morag



    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    ------------------------------



  • 3.  RE: CorrelationID is not refreshed when using pub sub ?

    Posted Tue July 14, 2020 05:18 AM
    "If we put a message on the Alias queue, the CorrelationID never change, is this expected behaviour  ?"
    This is a question about MQ clients - can you tell us what client you are using to put/get messages?
    I'm going to assume JMS for now..
    It all depends on whether you are allowing the underlying messaging client (e.g. the JMS libraries) to set the correlation ID or you are setting it yourself. The defaults (in the MQ JMS client) set the correlID for you and *should* be unique to each message. 

    "Or maybe is it possible to switch off the creation of the CorrelationID ?"
    One doesn't so much switch it off as override it using the client code which PUTS the message to the alias.


    ------------------------------
    John Hawkins
    Integration Consultant
    ------------------------------



  • 4.  RE: CorrelationID is not refreshed when using pub sub ?

    Posted Tue July 14, 2020 05:52 AM
    hi John,
    Thanks for your response and for your explanation.  The producer is a IBM AS400, thats not JMS based: its MQ Classic or something like that coded in RPG. The consumer is a JMS 2.0 based MQ Java Client.

    But the problems is solved thanks to the link above from Morag.

    If this parameter is added in the DEFINE SUB instruction then correlationID is set to 000000000.
    DESTCORL(0)
    My Java JMS client is then setting an ID by itself, so problem solved.
    Kind regards

    ------------------------------
    Bernard Pittens
    Integration Engeneer
    Sligro Foodgroup B.V.
    Veghel
    ------------------------------