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.  MQ Undelivered Message Scenario

    Posted Thu July 16, 2020 07:12 AM
    Edited by Anurag M Thu July 16, 2020 07:17 AM
      |   view attached

    Hi, We are designing a system where we are getting all messages on MQ queue 'X' from external system. From this queue 'X' messages are further routing to the respective systems queues 'A', 'B', 'C' on same Queue Manager which are later processed by several applications.

    Now, i need below recommendations to design this kind of system. Attached is the sample design.

    1. What if queue 'A', 'B', or 'C' are full or unavailable. Will message rollback automatically back to the queue 'X' after some retries OR how is that ? Looking for best approach we should follow.

    2. If we have millions of messages coming on queue 'X' and because of unsuccessful delivery of one message to another queues 'A', 'B' on same QM; how the delay of delivery of unsuccessful message can be handled when resources (queues 'A', 'B') are available again.

    Please suggest some good approach we can follow considering performance as well.

    Any assistance would be much appreciated. Thanks!



    ------------------------------
    Anurag
    ------------------------------

    Attachment(s)

    docx
    Sample Design.docx   45 KB 1 version


  • 2.  RE: MQ Undelivered Message Scenario

    Posted Thu July 16, 2020 08:09 AM

    What you do when one (or more) of Queue A, B or C reject the MQPUT of a message onto it depends on a few criteria about your messages. Mainly ordering. Is it essential that the messages on Queue X remain in the same order when they are delivered downstream?

    If order is not required, then one technique (utilised by MQ queue manager channels) is to retry a few times (just in case it is a transitory problem) and then to write the message to a side queue (called the Dead Letter Queue in the case of channels, or some applications use the Backout Queue for putting messages to one side) for later processing. Then you can get on with delivering messages to the queues that are still accepting messages.

    You ask whether the message will rollback automatically to QueueX after some retries. Well that depends on what you code. Assuming that you get the messages from QueueX using Syncpoint (MQGMO_SYNCPOINT), then if you have a failure, you can roll the message back onto Queue X again using the MQBACK verb. However, if you are moving it to the side queue, then you won't need to roll back the message. I assume you are designing and writing the application that reads from QueueX and puts to Queues A,B&C? 

    Alternatively I suppose you might be using Message Broker, aka IBM ACE to do this routing? In which case it has all this sort of processing built in.

    As to the side queue, you would also need to process that. You could in your application, keep track of whether messages to Queue A, which was previously failing to accept messages, is now back and open for business again, and you could then go and read from the side queue and grab all the side-lined messages. Alternatively, you could have a process a bit like the Dead Letter Queue Handler which periodically retries all the failed puts.

    What are you using to determine which message goes to which queue?

    Is there any reason why you want this staging queue, rather than using MQ channels to do all the above for you by having the External system use the Queue A,B&C queue names instead of QueueX?

    Cheers,
    Morag



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



  • 3.  RE: MQ Undelivered Message Scenario

    Posted Thu July 16, 2020 10:28 AM
    Edited by Anurag M Wed July 29, 2020 09:50 AM
    Thanks you so much for your inputs Morag.

    Yes your understanding is correct. We are working on application which will read the message from Queue X and deliver further to Queue A, B and so on the same QM.

    Messages on the Queue X will deliver further based on some criteria which is defined within the Java Application. Application continuously sense the incoming messages on Queue X from external system. Messages which doesn't fits under that criteria will be discarded to Dead letter Queue. So as soon as message arrives to Queue X, necessary action is taken immediately.

    We are in discussion to go with an option of retrying a message for few times and if failed in all attempts, then put the message to backout queue and process them once resources are available again. What is the recommended way of setting the retry intervals assuming we are planning to do 3 retries. Is it OK to set 5 secs wait time before every retry OR any recommended duration considering peak load (Million of incoming messages on Queue X).

    Also, in case the backout queue also gets full, what options do you suggest would be best suited OR is recommended?

    External system is mainframe which will send all messages to one specific Queue X on Linux platform. But there is no criteria set on mainframe for the message , whether it meant for application A, application B, and so on linux end. Hence ,we developed a solution which will filter out the messages based on some criteria from Queue X and send further to Queue A, B and so on. Application A, application B, and so on are the consumers of those messages from respective queues (A,B and so on). Any thoughts on improvising this as well ??

    ------------------------------
    Anurag
    ------------------------------



  • 4.  RE: MQ Undelivered Message Scenario

    Posted Fri July 17, 2020 04:21 AM

    Hi Anurag
    1)
    No, messages will not automatically rollback to queue X. But it is an option
    queue X does not know that queue A is full.
    What happens when a message cannot be delivered:
    https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.con.doc/q015720_.htm
    Queue depth events
    https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.mon.doc/q036420_.htm
    My proposal
    One can monitor queue events e.g. full by 25%, 75%.
    Stop sending messages into the queue when it is full by 75%
    Application X could work with a configuration file that states do not send Messages to A when almost full send it to A.ELSE
    The "queue monitoring" would control the content of this configuration file.
    2)
    You could ask Application A to first consume messages from A.ELSE then from A
    Or let another support tool move messages from A.ELSE to A

    Queue Full of A,B or C is not your only risk.
    What shall happen if Mainframe sends messages faster to queue X then your app distributes it from X to A,B,C



    ------------------------------
    Matthias Jungbauer
    ------------------------------



  • 5.  RE: MQ Undelivered Message Scenario

    Posted Wed July 29, 2020 09:48 AM
    Edited by Anurag M Wed July 29, 2020 09:55 AM

    Thanks Matthias and sorry for delay , was on vacations.

    Anyways we have this distribution of messages from queue X to queues A, B and C on the same queue manager & our java applications further process the messages from these A, B, & C queues respectively.

    1. We will be putting the messages to backout queue (A.ELSE) as you mentioned if something goes wrong with A, B and C queues, (assuming they are full). But if application A starts consuming from A.ELSE & also the messages from queue X now will keep coming on A.ELSE always, because queue A will remain full all the time as application started processing messages from A.ELSE. How this can be handled?

    2. Also, is it good practice to move messages from A.ELSE back to source queue 'X' ? If yes , can this be established as Queue to Queue transmission on same queue manager?

    3. How i will be notified in case i set the Queue Depth events? Let's say i enable the Queue Depth High event to 80%, so how do i come to know when this limit is reached?



    ------------------------------
    Anurag
    ------------------------------



  • 6.  RE: MQ Undelivered Message Scenario

    Posted Wed July 29, 2020 10:42 AM
    1.
    Application A must be able to process messages faster than X distributes them into A/A.ELSE
    If no messages in A.ELSE consume from queue A
    If queue A is back to normal tell X to send messages to A again
    2.
    Given that queue full is not a good practice, moving the messages is also not a good practice.
    If a queue contains millions of unconsumed messages - this is just not a good thing.
    3.
    You can tell MQ what it shall do if the event 80% got triggered. Executing a shell script, sending you a ticket, email, voice call, etc.

    Given your model consists of only 4 queues you could author a mind map that states what shall happen when a queue is almost full, who or what to inform about it and how to resume after the cause for queue full is removed.

    What is your expected message throughput?
    100 messages per second = 360,000 messages an hour. -> a few millions within 24 hours

    What are your colleagues thinking about your queue full scenario?


    ------------------------------
    Matthias Jungbauer
    ------------------------------