|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Defining Multiple Queues for Same Queue Connection Factory |
« View previous topic :: View next topic » |
Author |
Message
|
cnu |
Posted: Mon Jan 16, 2006 1:41 pm Post subject: Defining Multiple Queues for Same Queue Connection Factory |
|
|
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 |
|
 |
bower5932 |
Posted: Mon Jan 16, 2006 1:59 pm Post subject: |
|
|
 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 |
|
 |
cnu |
Posted: Mon Jan 16, 2006 2:10 pm Post subject: |
|
|
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 |
|
 |
mvic |
Posted: Mon Jan 16, 2006 2:49 pm Post subject: |
|
|
 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 |
|
 |
bower5932 |
Posted: Mon Jan 16, 2006 2:58 pm Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Mon Jan 16, 2006 5:02 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Mon Jan 16, 2006 6:34 pm Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|