Topic
  • 3 replies
  • Latest Post - ‏2017-07-01T05:00:54Z by MoragH
rafDevPRo
rafDevPRo
2 Posts

Pinned topic Multiple Consumers listening to same queue, will this implementation be a production grade code and how well it is supported by IBM MQ. What likely failure scenarios can I still expereince?

‏2017-06-29T06:37:52Z | mq

Multiple Consumers listening to same queue, will this implementation be a production grade code and how well it is supported by IBM MQ.

What likely failure scenarios can I still experience?

Any experiences would be much appreciated.

  • MoragH
    MoragH
    131 Posts

    Re: Multiple Consumers listening to same queue, will this implementation be a production grade code and how well it is supported by IBM MQ. What likely failure scenarios can I still expereince?

    ‏2017-06-30T03:51:23Z  

    Having multiple consumers reading from the same queue is a normal and expected pattern in IBM MQ. It is well supported.

    Whether your application code implementation is production grade is not a question that can be answered on here.

    Make sure you set your queue to be sharable and if your application uses the default share option then ensure it is set to shared and not exclusive otherwise you will experience a 2042 (MQRC_OBJECT_IN_USE).

    Make sure you understand that IBM MQ will attempt to keep one consumer "hot" and will not distribute messages equally around all consumers. It is a more efficient use of the resources on the machine to keep an active consumer more active rather than swapping in and out all the time. Of course, if the active one is not ready to receive a second message, another consumer will be woken up to deal with it.

    Cheers,
    Morag

  • rafDevPRo
    rafDevPRo
    2 Posts

    Re: Multiple Consumers listening to same queue, will this implementation be a production grade code and how well it is supported by IBM MQ. What likely failure scenarios can I still expereince?

    ‏2017-06-30T04:08:27Z  
    • MoragH
    • ‏2017-06-30T03:51:23Z

    Having multiple consumers reading from the same queue is a normal and expected pattern in IBM MQ. It is well supported.

    Whether your application code implementation is production grade is not a question that can be answered on here.

    Make sure you set your queue to be sharable and if your application uses the default share option then ensure it is set to shared and not exclusive otherwise you will experience a 2042 (MQRC_OBJECT_IN_USE).

    Make sure you understand that IBM MQ will attempt to keep one consumer "hot" and will not distribute messages equally around all consumers. It is a more efficient use of the resources on the machine to keep an active consumer more active rather than swapping in and out all the time. Of course, if the active one is not ready to receive a second message, another consumer will be woken up to deal with it.

    Cheers,
    Morag

    Thanks for your reply Morag, much appreciated. As you mentioned IBM MQ will try to keep one consumer "hot", will it help me to achieve the purpose of having multiple consumers or is there any algorithm configurations I can configure in IBM MQ like use round robin or something like that.

  • MoragH
    MoragH
    131 Posts

    Re: Multiple Consumers listening to same queue, will this implementation be a production grade code and how well it is supported by IBM MQ. What likely failure scenarios can I still expereince?

    ‏2017-07-01T05:00:54Z  
    • rafDevPRo
    • ‏2017-06-30T04:08:27Z

    Thanks for your reply Morag, much appreciated. As you mentioned IBM MQ will try to keep one consumer "hot", will it help me to achieve the purpose of having multiple consumers or is there any algorithm configurations I can configure in IBM MQ like use round robin or something like that.

    This is the built-in behaviour, there is no queue attribute to change it. It is the most efficient way to use the machine resources. Your application should neither know nor care that one instance of it is processing more messages than the others so long as all the messages are processed in the most timely manner using the least amount of machine resources. It is standard practice for multiple consumers reading from a queue. You certainly shouldn't be relying on an even spread. Is there a reason that you care? Does your application have a reliance on an even spread?

    Cheers,
    Morag