ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Multiple access to shared queue with ConnectionConsumer

Post new topic  Reply to topic
 Multiple access to shared queue with ConnectionConsumer « View previous topic :: View next topic » 
Author Message
griffel
PostPosted: Mon Oct 08, 2007 1:31 pm    Post subject: Multiple access to shared queue with ConnectionConsumer Reply with quote

Novice

Joined: 22 Mar 2005
Posts: 23

Hi,

we have two version 6 queue managers MQ1A and MQ1B serving a clustered queue-sharing group on zOS.
We have a shared queue on them, let's say QUEUE1.
We have two Java application processes getting messages from QUEUE1 using ConnectionConsumers (IBM's ASF stuff) connected to MQ1A.

Scenario 1: We put 10000 messages to QUEUE1. Both application processes GET them which ends up with let's say application 1 got 4930 messages, application 2 got 5001 messages, and 69 message still in the queue.
Starting a third application instance GETs the remaining 69 messages (the other two instances still being active).

Scenario 2: Same as scenario 1, but now each of the both application processes is connected to a different queue manager (that's app1 connects to MQ1A and app2 connects to MQ1B). Everything works fine, all 10000 messages are removed from QUEUE1 and are processed.

Scenario 3: Same as scenario 1, but now QUEUE1 is NOT shared (only a local queue to MQ1A). Again, everything works fine, all messages are removed and processes correctly.

Question: Why does scenario 1 end up with messages remaining on the queue? Does anyone know the exact semantics and GET/BROWSE behavior of IBM ConnectionConsumer implementation?

Any help appreciated,
Frank
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 08, 2007 2:06 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well Frank, you've left a lot unsaid:
Quote:
we have two version 6 queue managers MQ1A and MQ1B serving a clustered queue-sharing group on zOS.
We have a shared queue on them, let's say QUEUE1.
We have two Java application processes getting messages from QUEUE1 using ConnectionConsumers (IBM's ASF stuff) connected to MQ1A.

Scenario 1: We put 10000 messages to QUEUE1. Both application processes GET them which ends up with let's say application 1 got 4930 messages, application 2 got 5001 messages, and 69 message still in the queue.
Starting a third application instance GETs the remaining 69 messages (the other two instances still being active).


You are talking about connection consumers so I guess you are using JMS.

You did not specify if you were using a messageListener or just the receiver.receive()
functionality. Nor did you specify the speed of your receiver vs the speed of your sender...

It may be quite legitimate to have 69 messages left on the queue if the queue ran empty at some time and you stopped the receiver...


Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
griffel
PostPosted: Mon Oct 08, 2007 11:57 pm    Post subject: Reply with quote

Novice

Joined: 22 Mar 2005
Posts: 23

"ConnectionConsumer" is a Java Interface defined by the JMS standard (that's why I thought it might be a nice idea to post my problem to the Java/JMS discussion group ...).

A ConnectionConsumer implementation like IBM's (aka ASF) has no explicitly available receive, it just serves its "onMessage"-method using a supplied thread pool for session handling.

Therefore it is inherently concurrent anyway - that's why I'm even more surprised that adding another application process (BTW, each of them uses 5 threads with its ConnectionConsumer) result in concurrency problems.

All 10000 messages are put to the queue. The applications are started after this and stay up. BTW, if I put another message to the queue when there are some messages remaining they are all caught and process. Thus, the application proccesses seem to work normally. It looks like the consumers "get out of synch" / "forget to browse again" or the like.

BTW, no selectors are used - just get everything from the queue.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 09, 2007 1:51 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Now we are getting somewhere.
It looks to me that you might be writing your own session pools/connection pools or not using the jndi setup according to best practice.

There is an old but excellent document about JMS topology (IBM redbooks) that will give you a much better insight about the concurrency issues.

Basically each MDB assigned to a queue should have it's own connection. Each instance of the MDB on that same queue should have it's own connection. The why is about multithreading and performance...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
griffel
PostPosted: Wed Oct 10, 2007 12:27 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2005
Posts: 23

Sorry, but ...

JNDI is not about session handling. Actually, you're right - we don't
use JNDI (just adds another complexity and its not needed if you just want to get a factory for your connections).
IBM's implementation of ConnectionConsumer needs a "self made" session pool handling. We use the example implementation delivered by IBM with some minor enhancements.
We do not use MDBs (just another useless complexity ...) - just plain Java and the JMS/MQ packages. And: Our systems run very well for the last three years - its just that we now want to go shared-queues to get real availability. We're quite experienced with all that stuff, in fact invented some of it ourselves. Maybe, our mistake was to use a piece of pre-fabricated code (IBMs ASF) instead of writing our own receiver/consumer. Now we need in-depth knowledge about this specific implementation.

Anyway, thanks for contemplating,
Frank
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 10, 2007 2:15 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Ok.. So the big problems you're going to run into is when you either stop/close the connection and the session/session consumer is still open and has registered MessageListeners....

Not a nice picture...

If you need more pointers let me know...

On top of this if you want true concurrency you should be using mutliple connections. The connection will synchronize the put/get to/from the same destination...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
griffel
PostPosted: Wed Oct 17, 2007 7:32 am    Post subject: SOLVED Reply with quote

Novice

Joined: 22 Mar 2005
Posts: 23

Just in case someone reads this in search of solutions to similar problems:
Setting the property com.ibm.mq.jms.tuning.QATVersion=1 on the Java client side cause the MQQueueAgent to use the old style mechanism and everything works fine. Thus, its a bug fixed by IBM's latest patches for MQ V6/zOS (needs at least level 6.0.2.1 on the Java side).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Multiple access to shared queue with ConnectionConsumer
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.