Author |
Message
|
jeevan |
Posted: Tue Nov 02, 2010 4:25 am Post subject: sending messag to cluster qmgr |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
I am planning to write an utility similar to DSPMQRTE. our scenario is liek this
comsumer>bridge->requester
The consumer in another scenario will become requester. in fact bth sides are service requester and services providers on different context.
I want to send message from one end to bridge qmgr. then read from bridge to send to other end. then from that end send back to bridge qmgr and back to original sender. So that I know which message is not sent back and figure where is the problem.
my questions is lets say I connect to qmgr A ( at one end) and send a message to a Queue Called REQUESTER.QUEUE at bridge qmgr. The bridge qmgr is in cluster but the queue is not. how can I send message ? I did not see a qmgr field in message structure.
In real scenario they are doing this. for some queues there are aliases but for some there are qmgr alias.
Or in another word, how can I send a message to a queue in a cluster qmgr( the queue is local to the queue manager) connecting to another cluster qmgr?
Thanks |
|
Back to top |
|
 |
Mr Butcher |
Posted: Tue Nov 02, 2010 5:03 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
you said the queue is not in the cluster, then you need to have a remotequeue definition on the cluster queuemanager you are connected to pointing to the target cluster queuemanager name / target queue name.
As both queuemanagers are in the cluster, you do not need to specify a xmitq in there. just specify targetqueue and targetqueuemanager. the MQ cluster will find the proper channel to the target cluster queuemanager. _________________ Regards, Butcher |
|
Back to top |
|
 |
jeevan |
Posted: Tue Nov 02, 2010 5:06 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Mr Butcher wrote: |
you said the queue is not in the cluster, then you need to have a remotequeue definition on the cluster queuemanager you are connected to pointing to the target cluster queuemanager name / target queue name.
As both queuemanagers are in the cluster, you do not need to specify a xmitq in there. just specify targetqueue and targetqueuemanager. the MQ cluster will find the proper channel to the target cluster queuemanager. |
But i did not see where I can mention the qmgr that I am sending message to? I konw how to mention the queue name though. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 02, 2010 5:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You mention the queue name and qmgr name when you do an MQOPEN. It's not a part of the MQMD. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 02, 2010 5:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jeevan wrote: |
But i did not see where I can mention the qmgr that I am sending message to? |
The remote queue definition contains this information. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jeevan |
Posted: Tue Nov 02, 2010 5:16 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Vitor wrote: |
jeevan wrote: |
But i did not see where I can mention the qmgr that I am sending message to? |
The remote queue definition contains this information. |
I am not using remote queue as both qmgrs are in the same cluster. I am connecting to a cluster qmgr and sending a message to a queue in another qmgr whic is also in the same cluster.
So, I have to either set it somewhere ( mqpmo or mqmd or whatever). This is exact scenario when our app send message to. we have in fact different scenario however, this is one of them. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 02, 2010 5:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jeevan wrote: |
I am not using remote queue as both qmgrs are in the same cluster. |
If you're using a cluster alias as Mr Butcher suggested you are
Or you open it directly as my other most worthy associate suggested. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jeevan |
Posted: Tue Nov 02, 2010 5:46 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Vitor wrote: |
jeevan wrote: |
I am not using remote queue as both qmgrs are in the same cluster. |
If you're using a cluster alias as Mr Butcher suggested you are
Or you open it directly as my other most worthy associate suggested. |
Thanks folks. I think I got it. I need to mentioned the queue manager while opening queue.
thanks |
|
Back to top |
|
 |
jeevan |
Posted: Wed Nov 03, 2010 6:40 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
jeevan wrote: |
Vitor wrote: |
jeevan wrote: |
I am not using remote queue as both qmgrs are in the same cluster. |
If you're using a cluster alias as Mr Butcher suggested you are
Or you open it directly as my other most worthy associate suggested. |
Thanks folks. I think I got it. I need to mentioned the queue manager while opening queue.
thanks |
I thought I understood, but I was not correct. I still have a question. I did not see any MQOPEN verb used in my code( I am not a programmer just trying to do an utility for admin help, so looking everytime I have to use some API)
public class MSender {
private static MQQueueManager qMgr;
public MSender() {
super();
}
public static void main(String args[]) {
try {
if (args.length < 1) {
System.out.println("Missing queue name: "
+ "MSender <queue name> <qmgr name (optional)>");
} else {
System.out.println("MSender started...");
// create a new instance of the sample program
MSender mSender = new MSender();
if (args.length > 1) {
qMgr = new MQQueueManager(args[1]);
} else {
qMgr = new MQQueueManager("");
}
int openOptions = MQC.MQOO_OUTPUT;
MQQueue q =
qMgr.accessQueue(args[0], openOptions, null, null, null);
// call method to send messages
mSender.mPut(qMgr, q);
// clean up connection
q.close();
qMgr.disconnect();
System.out.println("MSender ended...");
}
} catch (MQException ex) {
System.out.println(
"WMQ exception occurred : Completion code "
+ ex.completionCode
+ " Reason code "
+ ex.reasonCode);
}
do I use remote queue and qmgr in place in null? is there any sample( I looked at capitalware) but did not see any for what I am looking for.
Thanks |
|
Back to top |
|
 |
|