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 » How to configure 2 apps/services with a common queue

Post new topic  Reply to topic Goto page 1, 2  Next
 How to configure 2 apps/services with a common queue « View previous topic :: View next topic » 
Author Message
weskelton
PostPosted: Thu Sep 16, 2010 9:24 am    Post subject: How to configure 2 apps/services with a common queue Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

I'm in the process of developing a java-based service that will be taking requests from the same MQ queue as another service that will be hosted on the same Websphere server. The services identify their respective messages by correlationID, i.e. a messageSelector in the MDB configuration. The two services are each part of their own application on the server.

I initially started defining a separate queue destination and JMS listener port for the new service. Unfortunately, this seemed to prevent the new service from ever getting a message.

Can someone tell me how I should configure these apps to co-exist? How many queue destinations? how many listeners? should these be shared? Will multiple MDB's in separate apps be able to pull off their respective messages?

Any assistance will be greatly appreciated. Thanks.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Sep 16, 2010 9:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What reason do you have for wanting to feed two entirely separate processes from the same queue?

If you see that there are messages sitting on the queue, which service is having an issue?
Back to top
View user's profile Send private message
weskelton
PostPosted: Thu Sep 16, 2010 9:47 am    Post subject: Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

Quote:
What reason do you have for wanting to feed two entirely separate processes from the same queue?


I have no other reason than the fact that this is the way that it has already been done. The services that are being built are replacing legacy services. The clients are already using this single-queue / multi-message strategy and changing them is not an option.

What I've seen is that while the first service was running, the new service didn't get any messgaes. Since the correlationID of the messages didn't match the messages for the second service simply sat out on the queue. I was able to get messages to the second service only after shutting down the first app/service and pointing the second app at the original listener port.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 16, 2010 9:54 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Have you reviewed the sample as suggested here?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 16, 2010 9:58 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

weskelton wrote:
I have no other reason than the fact that this is the way that it has already been done. The services that are being built are replacing legacy services. The clients are already using this single-queue / multi-message strategy and changing them is not an option.


That's no reason not to change this rather silly design. The clients could continue to put to a single queue as currently where a single service reads the messages and redirects the messages to separate queues to be consumed by specific services. Unless there's some specifically Java-based reason why this wouldn't work (and message context was maintained) then this would split things out and give better performance.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
weskelton
PostPosted: Thu Sep 16, 2010 10:33 am    Post subject: Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

Vitor,

Thanks for the reply. Yes, I did review the sample suggested in the previous link. That's how I got the first Webpshere java-based service into production. Now I'm in the process of retiring a second legacy service and moving it to java and Websphere. I can appreciate the advantages of your splitting design. There is one more gotcha though. The legacy clients currently pull their respective reply messages off of the reply queue by messageID. As a result, I am forced to use the base MQ API to send back non-JMS responses inn order to retain the specific messageID. Not sure if it's a deal breaker, but I think it does complicate the splitting scenario a bit.

Just curious though, other than not liking the legacy design, is there a reason to think that it couldn't be made to work with two apps/services on the same server listening on the same queue?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Sep 16, 2010 10:48 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The only technical reason why you can't have two separate processes reading from the same physical queue is that one of those two separate processes has opened the queue for exclusive input.

There may be things going on that are more specifically JMS, but I've not played around with pure JMS in long enough that I'm not going to speculate on what.

You might, for example, need multiple sessions.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Thu Sep 16, 2010 10:50 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7717

Put a few hundred thousand messages into the queue to simulate Application A being down. Let us know how Application B performs trying to get its specific messages out of the same queue.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 16, 2010 10:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

weskelton wrote:
Just curious though, other than not liking the legacy design, is there a reason to think that it couldn't be made to work with two apps/services on the same server listening on the same queue?


Identifying which message goes with which service. Any solution that relies on a message selector is riding for a fall. They're better in WMQv6 than in WMQv5, and better in WMQv7 than in WMQv6, but they're still an inefficient way of reading a message off a queue. If you try and scale this solution to a point where there's any depth to it, you'll find the message read getting slower and slower. Remember the queue has no index so the queue manager has to scan the queue from the top each time.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
weskelton
PostPosted: Thu Sep 16, 2010 12:14 pm    Post subject: Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

I just realized that as long as I have other legacy services (yes a 3rd service - non-Websphere) still listening on the original queue, then the splitting solution probably won't work.

So back to the original question...

How do I configure the Websphere-based applications/services to co-exist and still be able to get all of their messages and only their messages from the common queue?

And please realize that I'm playing the hand I'm dealt. Performance has not been an issue for the legacy services over the nearly 10 years that they have been in place. And I don't perceive a need for these to scale beyond there current usage pattern.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Thu Sep 16, 2010 12:33 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7717

weskelton wrote:

How do I configure the Websphere-based applications/services to co-exist and still be able to get all of their messages and only their messages from the common queue?

You can't. If an app (or more correctly a particular User ID) has access to a queue, it has the same level of access for any and all messages in that queue.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
weskelton
PostPosted: Thu Sep 16, 2010 12:53 pm    Post subject: Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

I'm confused. Is this just a limitation of Websphere or JMS? The reason I ask, is that I currently have the first Websphere/JMS service in production and it is taking it's messages from the common queue based on correlationID using a messageSelector in my MDB. The other messages on the queue are being taken off by their legacy Windows/C-based services.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Sep 16, 2010 12:55 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The point Peter is making is that you can not PREVENT an application that can get one message from a queue from getting any message it wants to.

You can indeed keep multiple apps reading from one queue, but outside of an API exit, you can not do anything to control which messages they are *allowed* to get.

Using a correlationID/messageId selector will always get exactly and only the message you ask for, but you can't control what messages are allowed to be asked for.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 16, 2010 12:56 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

weskelton wrote:
How do I configure the Websphere-based applications/services to co-exist and still be able to get all of their messages and only their messages from the common queue?


This is a slightly different question to the original one.

Only one application reading messages off while another sits and waits implies (all security issues being equal) that the first has an exclusive lock on the queue. For this I'd expect the second to be throwing exceptions says the queue won't open. If it's not, then there's something wrong with the way the message selection is being done. Key question here is: is the first application only reading it's own messages and leaving the rest, or is it consuming everything?

As to how they get only their messages, that's on the good faith of the application. Any application reading the queue is allowed by WMQ to read any message. If any application tries to read a message not destined for it (either through code fault, configuration error or malicious intent) then nothing in WMQ will stop it. This is another reason to keep applications on separate queues....!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
weskelton
PostPosted: Thu Sep 16, 2010 1:14 pm    Post subject: Reply with quote

Novice

Joined: 22 Feb 2010
Posts: 10

Thanks for the replies so far. The legacy services have been peacefully sharing the common queue for a good while now, so as long as I can assure that my new services take only their messages, then all should continue to be good.

The problem that I have, is that the new service is not getting any messages. These are being left on the queue until they expire. This was true when I had a separate queue destination and JMS listener port defined for each of the 2 Websphere-based services. I have the same problem even when the 2 apps share a common JMS listener. The only way the the second service gets a message is if the first service is shutdown.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » How to configure 2 apps/services with a common queue
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.