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 » Defining Multiple Queues for Same Queue Connection Factory

Post new topic  Reply to topic
 Defining Multiple Queues for Same Queue Connection Factory « View previous topic :: View next topic » 
Author Message
cnu
PostPosted: Mon Jan 16, 2006 1:41 pm    Post subject: Defining Multiple Queues for Same Queue Connection Factory Reply with quote

Apprentice

Joined: 15 May 2004
Posts: 34

Can I define multiple JMS queus using the same Queue Connection Factory? Thanks in advance
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Jan 16, 2006 1:59 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You would define multiple queues by using multiple Queues which could share the same Connection Factory.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
cnu
PostPosted: Mon Jan 16, 2006 2:10 pm    Post subject: Reply with quote

Apprentice

Joined: 15 May 2004
Posts: 34

Is there any document I can use for doing this or a sample example which shows how to share the same connection factory? I am using WAS 5.1 as application server. Thanks alot
Back to top
View user's profile Send private message
mvic
PostPosted: Mon Jan 16, 2006 2:49 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

cnu wrote:
Is there any document I can use for doing this or a sample example which shows how to share the same connection factory? I am using WAS 5.1 as application server. Thanks alot


Connection Factories are used to create Connections. Queue Connection Factories are used to create Queue Connections. The writers of the JMS 1.1 spec would prefer us to use Connection, and not QueueConnection, and this seems like a good idea to me, as the app code becomes slightly easier to read, but it's up to you.

Following JMS 1.1 now...
From a ConnectionFactory you create a Connection. From a Connection you create a Session. From a Session you create a Queue object (containing the queue name) and a MessageConsumer, specifying the Queue object you have created. Then, the MessageConsumer is the object you use to receive messages from the queue.

Simple, eh?

Now, do you really want to use multiple queues from a Connection Factory? I imagine no. You probably need to create multiple MessageConsumer objects on the Session, one for each queue.

If you have high throughput, and wish for the queues to be operated independently from each other then probably it's best to create multiple Sessions, since each Session is, in principle, separable from the others, and can be operated on a dedicated thread.

Check out the JMS Spec and API for more details.
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Jan 16, 2006 2:58 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I was reading 'use' as 'define'....I always define a single connection factory for my queue manager and then unique queues under that. This keeps the number of definitions that I have down. Sorry for any confusion.

(I actually create two connection factories - one for bindings, one for client.)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
jefflowrey
PostPosted: Mon Jan 16, 2006 5:02 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I guess, maybe, one of the problems with sharing a Session between multiple QueueDestionations is...

I think the Session is the Transaction Coordinator... that is, if you have multiple Queue Destinations sharing a session, they might all automatically participate in the same unit of work in J2EE coordinated transactions.

So, then, you might have issues using the same Sesssion with completely different (logically) units of work.

You can use the same QCF to create multiple Sessions, I think.

And I'm sure that if this is wrong, then ... someone (fjb_saper) will correct me.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 16, 2006 6:34 pm    Post subject: Reply with quote

Grand High Poobah

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

No problem Jeff. You're right on the money.

The JMS session acts indeed as the transaction coordinator under orders from the J2EE Transaction Manager (TM). So if multiple destinations need to participate in the same LUW make sure all the consumers or producers are created under the same Session, or if using multiple providers, that you use the same provider session inside each provider. The TM will coordinate across providers.

You could potentially use multiple sessions and let the TM take care of coordinating the LUW... Though that makes for much more coding and much more difficult to read or maintain... and I have never tried it that way.

Last and not least if you are outside the APP server, the TM will be MQ and the only way you get to put multiple operations into the same LUW is if they participate in the same Session.

In the JMS model the J2EE container takes care of JAAS authentication as well as connection pooling.

Remember as well that each MDB or instance of MDB runs in its own session. Usually each message there is its own LUW.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Defining Multiple Queues for Same Queue Connection Factory
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.