Author |
Message
|
dudetom |
Posted: Thu Jul 12, 2018 10:49 pm Post subject: Multiple IMessageConsumers on same queue |
|
|
Apprentice
Joined: 29 Sep 2017 Posts: 45
|
We plan to deploy multiple client application instances on different servers (for failover & load-balancing reasons). These client applications are actually duplicates of each other and they make connections on the same way and consume messages out of the same queue.
We use IBM MQ Client 8.0.0.5 with IBM.XMS and C#.
We have 2 questions:
1. If there are multiple consumers on one queue, on which consumer does a message arrive? Is there some kind of auto Round-Robin balancing?
2. Does one message arrive on all consumers or is it removed from the queue when it's consumed by one client application? |
|
Back to top |
|
 |
hughson |
Posted: Thu Jul 12, 2018 11:58 pm Post subject: Re: Multiple IMessageConsumers on same queue |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
dudetom wrote: |
1. If there are multiple consumers on one queue, on which consumer does a message arrive? Is there some kind of auto Round-Robin balancing? |
Generally speaking the queue manager will endeavour to keep one consumer 'hot' as this is a more efficient use of O/S resources.
dudetom wrote: |
2. Does one message arrive on all consumers or is it removed from the queue when it's consumed by one client application? |
That depends on how you write your consumers. If you browse the messages then they are not removed, if you get them in a destructive manner (i.e. the opposite of a browse) then yes they are removed and only one consumer will see the message.
P.S. None of this is specific to XMS and C#
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 13, 2018 1:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you have multiple receivers for your messages, you should make sure that each uses a Unit of Work and transaction...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
dudetom |
Posted: Fri Jul 13, 2018 3:09 am Post subject: Re: Multiple IMessageConsumers on same queue |
|
|
Apprentice
Joined: 29 Sep 2017 Posts: 45
|
Morag, I didn't set anything like browse or something else on my listeners.
We use MessageListener objects (XMS) like below, nothing special.
consumer = session.CreateConsumer(destination);
consumer.MessageListener = listener;
Is this a destructive manner ?
Last edited by dudetom on Fri Jul 13, 2018 3:13 am; edited 1 time in total |
|
Back to top |
|
 |
dudetom |
Posted: Fri Jul 13, 2018 3:11 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2017 Posts: 45
|
fjb_saper, why would a unit of work be requirement in case of multiple consumers? It should always be a requirement?
We don't throw any exception in the listener method anyway. We catch all exceptions. |
|
Back to top |
|
 |
hughson |
Posted: Fri Jul 13, 2018 3:32 am Post subject: Re: Multiple IMessageConsumers on same queue |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
dudetom wrote: |
Morag, I didn't set anything like browse or something else on my listeners.
We use MessageListener objects (XMS) like below, nothing special.
consumer = session.CreateConsumer(destination);
consumer.MessageListener = listener;
Is this a destructive manner ? |
Yes that will be destructive.
To browse you would use a Queue Browser.
Read more: Queue Browsers
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
|