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 » Obtain cluster queue

Post new topic  Reply to topic
 Obtain cluster queue « View previous topic :: View next topic » 
Author Message
mikivin
PostPosted: Thu Apr 06, 2006 6:58 am    Post subject: Obtain cluster queue Reply with quote

Novice

Joined: 06 Apr 2006
Posts: 10

Hi,
I'm new to WebSphere MQ world.My question is:
I have some queue managers (QM1,QM2...) on different machines in one cluster. I create cluster queue Q1. I need put/get messages to Q1 from all queue managers in the cluster by JMS. I connect to JNDI this way:
java.util.Hashtable environment = new java.util.Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, ""com.ibm.mq.jms.context.WMQInitialContextFactory"");
environment.put(Context.PROVIDER_URL, ""localhost:LISTENER_PORT/SERVER_CONNECTION_CHANNEL");
Context ctx = new InitialContext(environment);
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(QMXXX);
QueueConnection conn = factory.createQueueConnection();
QueueSession session = conn.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue)ctx.lookup(Q1);
I get exception : Object not found

I cant find cluster queue Q1 on all queue managers except one queue manager where is local queue (when luster queue created).

How can I put/get messages to Q1 from all queue managers in the cluster by JMS ? Maybe I should connect to JNDI another way?Any suggestion ?

Thanks in advance.
Miki
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Apr 06, 2006 7:00 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You will only ever be able to GET messages if you are connected directly to the qmgr that has Q1 as a qlocal.

You will be able to PUT to Q1 from any queue manager in the cluster, regardless of whether or not you can "see" it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mikivin
PostPosted: Thu Apr 06, 2006 7:15 am    Post subject: Reply with quote

Novice

Joined: 06 Apr 2006
Posts: 10

jefflowrey wrote:
You will only ever be able to GET messages if you are connected directly to the qmgr that has Q1 as a qlocal.

You will be able to PUT to Q1 from any queue manager in the cluster, regardless of whether or not you can "see" it.


But I can't get cluster queue by lookup. How I can put mesage ?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 06, 2006 7:28 am    Post subject: Reply with quote

Grand High Poobah

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

Take pity on a man with very little Java - what do mean by lookup? In JNDI the queue is a location which in this case resolves to a cluster queue. So long as the queue manager you're connected to is part of the cluster you can put to it. As jefflowery correctly points out, you can only get from the local instance of a cluster queue, if there is one.

It's a common trick (pre-v6.0) to put from a queue manager that does not have a local queue to use workload balancing; at that level messages always went to the local copy of a cluster queue if there was one. Post v6.0 it's a bit more sophisticated (I'm told).

Please explain more clearly what you mean by lookup, with particular reference with what I got wrong in my description. Java / JNDI is not my happy place!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Apr 06, 2006 7:29 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You have made several design decisions without understanding them.

You have decided to use Clusters without understanding the basics of clustering - including that you can only GET from qlocals and that qclusters are only "visible" to partial repositories if an application has issued a PUT against that qcluster already. That's why it's a partial repository - becuase it only holds the entries that it needs to hold but can look up any entries it doesn't know about from the full repositories.

You have decided to use the queue manager as your JNDI repository, rather than using an application server JNDI store or a database or a flatfile or etc - without understanding what information the queue manager has available to it at what times.

So do you want help reconsidering your design decisions, or do you want help applying kludges to your system so that your design decisions will work?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mikivin
PostPosted: Sun Apr 09, 2006 12:04 am    Post subject: Reply with quote

Novice

Joined: 06 Apr 2006
Posts: 10

Thanks to You for previous answers.
My design is : several queue managers on different machines( Websphere Brokers). They used same queue. I supposed to put all queue managers in cluster, create cluster queue to putting/getting messages.

Application that running on same machine where queue manager installed
using JMS to put/get messages to/from cluster queue. So we have one queue shared to all machines.

I understand that I can't get message from remoted queue managers .
What its better design to have common queue to distributed queue managers(different machines, diferrent brokers).

I write followwing code Java to put/get messages:

Context ctx = new InitialContext(environment);
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(cf);
Queue queue = (Queue)ctx.lookup(Q1); - I cant get cluster queue on distributed queue managers
How can I create cluster queue on distributed machines ?
Any another solution ?

Thanks in advance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sun Apr 09, 2006 10:20 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It is perfectly normal and perfectly reasonable design to host multiple copies of a queue in a cluster, and attach different copies of an application to each of those queues.

This is not your problem.

Where is your JNDI information being stored?

Your first post said you were using "com.ibm.mq.jms.context.WMQInitialContextFactory".

What do you think that means? How do you think that is affected by what queue manager you are connected to?
_________________
I am *not* the model of the modern major general.
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 » Obtain cluster 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.