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 » Java - Report from MQ

Post new topic  Reply to topic Goto page 1, 2  Next
 Java - Report from MQ « View previous topic :: View next topic » 
Author Message
solomon_13000
PostPosted: Fri Oct 24, 2008 7:09 am    Post subject: Java - Report from MQ Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

The code below works well for putting messages into MQ. The load balancing works perfect. I tried to obtain the report but no report is generated. How do I solve the problem?.


Java code

qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_OUTPUT ;
MQQueue MQ1_RQSTIN = qMgr.accessQueue("QM1.RQSTIN",openOptions);
MQMessage hello_world = new MQMessage();
hello_world.putApplicationName = "src_mqsample.txt";
hello_world.report = MQC.MQRO_COA ;
hello_world.replyToQueueName = "QM1.REPLY";

File file = new File("C:\\Documents and Settings\\My Documents\\JCreator LE\\MyProjects\\MQSample\\src_mqsample.txt");
StringBuffer contents = new StringBuffer();
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(file));
String text = null;


while((text = reader.readLine())!= null)
{
contents.append(text).append(System.getProperty("line.separator"));
}

hello_world.writeObject(contents);
MQPutMessageOptions pmo = new MQPutMessageOptions();
MQ1_RQSTIN.put(hello_world,pmo);


MQ Script

QM1

DEFINE QLOCAL(DEAD.QUEUE)

DEFINE QREMOTE(QM1.RQSTIN) RNAME(QM1.RQSTIN) RQMNAME(QM2) XMITQ(QM2.XMIT) PUT(ENABLED)

DEFINE QLOCAL(QM2.XMIT) USAGE(XMITQ) TRIGGER TRIGDATA(QM1.QM2.DF) TRIGTYPE(FIRST)

DEFINE CHANNEL(QM1.QM2.DF) CHLTYPE(SDR) TRPTYPE(TCP) XMITQ(QM2.XMIT) CONNAME('localhost(1415)')

DEFINE CHANNEL(QM2.QM1.DF) CHLTYPE(RCVR) TRPTYPE(TCP)

DEFINE QLOCAL(QM1.REPLY)

runmqlsr -m QM1 -t tcp -p 1420


QM2

DEFINE QLOCAL(DEAD.QUEUE)

DEFINE QREMOTE(QM1.RQSTIN) RNAME(QM1.RQSTIN) RQMNAME(ANY.QMGR) XMITQ(Q3.XMIT) PUT(ENABLED)

DEFINE QLOCAL(QM3.XMIT) USAGE(XMITQ) TRIGGER TRIGDATA(QM2.QM3.DF) TRIGTYPE(FIRST)

DEFINE CHANNEL(QM2.QM3.DF) CHLTYPE(SDR) TRPTYPE(TCP) XMITQ(QM3.XMIT) CONNAME('localhost(1416)')

DEFINE CHANNEL(QM1.QM2.DF) CHLTYPE(RCVR) TRPTYPE(TCP)

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM1) XMITQ(QM1.XMIT)

DEFINE QLOCAL(QM1.XMIT) USAGE(XMITQ) TRIGGER TRIGDATA(QM2.QM1.DF) TRIGTYPE(FIRST)

DEFINE CHANNEL(QM2.QM1.DF) CHLTYPE(SDR) TRPTYPE(TCP) XMIQ(QM1.XMIT) CONNAME('localhost(1420)')

DEFINE CHANNEL(QM3.QM2.DF) CHLTYPE(RCVR) TRPTYPE(TCP)

runmqlsr -m QM2 -t tcp -p 1415

runmqlsr -m QM2 -t tcp -p 1419


QM3

DEFINE QLOCAL(DEAD.QUEUE)

DEFINE QREMOTE(ANY.QMGR)

DEFINE CHANNEL(QM2.QM3.DF) CHLTYPE(RCVR) TRPTYPE(TCP)

DEFINE CHANNEL(QM3.QM4.DF) CHLTYPE(CLUSSDR) CONNAME('localhost(1417)') CLUSTER(CLUS2)

DEFINE CHANNEL(QM3.QM3.DF) CHLTYPE(CLUSRCVR) CONNAME('localhost(1416)') CLUSTER(CLUS2)

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM2) XMITQ(QM2.XMIT) CLUSTER(CLUS2)

DEFINE QLOCAL(QM2.XMIT) USAGE(XMITQ) TRIGGER TRIGDATA(QM3.QM2.DF) TRIGTYPE(FIRST)

DEFINE CHANNEL(QM3.QM2.DF) CHLTYPE(SDR) TRPTYPE(TCP) XMITQ(QM2.XMIT) CONNAME('localhost(1419)')

runmqlsr -m QM3 -t tcp -p 1416


QM4

ALTER QMGR REPOS(CLUS2)

DEFINE QLOCAL(DEAD.QUEUE)

DEFINE CHANNEL(QM3.QM4.DF) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(1417)') CLUSTER(CLUS2)

DEFINE CHANNEL(QM4.QM5.DF) CHLTYPE(CLUSSDR) CONNAME('localhost(1418)') CLUSTER(CLUS2)

DEFINE QLOCAL(QM1.RQSTIN) CLUSTER(CLUS2)

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM3) XMITQ('') CLUSTER(CLUS2)

runmqlsr -m QM4 -t tcp -p 1417


QM5

ALTER QMGR REPOS(CLUS2)

DEFINE QLOCAL(DEAD.QUEUE)

DEFINE CHANNEL(QM4.QM5.DF) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(1418)') CLUSTER(CLUS2)

DEFINE CHANNEL(QM3.QM4.DF) CHLTYPE(CLUSSDR) CONNAME('localhost(1417)') CLUSTER(CLUS2)

DEFINE QLOCAL(QM1.RQSTIN) CLUSTER(CLUS2)

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM3) XMITQ('') CLUSTER(CLUS2)

runmqlsr -m QM5 -t tcp -p 1418
Back to top
View user's profile Send private message
masteringmq
PostPosted: Mon Oct 27, 2008 11:19 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

It appears that you missed out the queue manager to which the report is to be sent. By just mentioning the name of the queue, mq will have no idea to which queue manager it should send the report.
Back to top
View user's profile Send private message
David.Partridge
PostPosted: Tue Oct 28, 2008 12:27 am    Post subject: Reply with quote

Master

Joined: 28 Jun 2001
Posts: 249

ReplyToQMgr is set by default (unless overridden by the application) to be the same as the QM at which the request message is put. Put another way, if you leave MQMD.ReplyToQMgr blank, then the queue manager will populate it with its own name as the message is put to the queue.

Check the MD when the message arrives ...

The problem you have is that the QMs at the far end of this don't know how to send a message back to Queue QM1.REPLY at QM1. You are assuming that the ReplyToQMgr will be blank - it won't be.

You will need to either:

a) Set up QMGR aliases for QM1 so that the COA messages can be routed back to QM1.

b) Set the ReplyToQMgr in the sending application to the name of a Cluster Alias (e.g. like your ANY.QMGR definition) at the target QMs (QM4 and QM5), thus allowing the QR QM1.REPLY to be found at QM4 and QM5
_________________
Cheers,
David C. Partridge
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Tue Oct 28, 2008 8:42 am    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

In QM4 and QM5 I have:

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM3) XMITQ('') CLUSTER(CLUS2)

But why cant the QM4 and QM5 use this remote queue to send a COA to QM1? Is it because the target Q refer a Q on QM2:

DEFINE QREMOTE(QM1.RQSTIN) RNAME(QM1.RQSTIN) RQMNAME(QM2)

which refer an unexisting Q:

DEFINE QREMOTE(QM1.RQSTIN) RNAME(QM1.RQSTIN) RQMNAME(ANY.QMGR)
Back to top
View user's profile Send private message
masteringmq
PostPosted: Tue Oct 28, 2008 10:15 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

Highly possible because ANY.QMGR does not exist.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Tue Oct 28, 2008 10:40 pm    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

Does it mean that in this scenario a report message must be generated by the receiving app then send to QM1 QM1.REPLY?.
Back to top
View user's profile Send private message
David.Partridge
PostPosted: Wed Oct 29, 2008 12:19 am    Post subject: Reply with quote

Master

Joined: 28 Jun 2001
Posts: 249

The key point here is that the COA is generated on either of QM4 or QM5 by the QMGR. The MQMD.ReplyToQMgr contains "QM1" (because the requesting application on QM1 set it to blanks), and the ReplyToQueue is set to "QM1.REPLY".

Neither QM4 nor QM5 know how to route messages back to QM1 unless you set up QM Aliases, so either:

1. Set up appropriate QMAs to route the reply back to QM1, or

2. Change the requesting applicatation to set MQMD.ReplyToQMgr to "ANY.QM" and create an ANY.QM cluster alias on both QM4 and QM5. If you do this the QM1.REPLY QR definition on QM4/QM5 will be found and used.
_________________
Cheers,
David C. Partridge
Back to top
View user's profile Send private message
masteringmq
PostPosted: Wed Oct 29, 2008 12:29 am    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

The code functions well. I notice in QM4 and QM5 you have

DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM3) XMITQ('') CLUSTER(CLUS2)

So you are expecting QM4 and QM5 to use the QR to route the COA to QM1. Does it work?.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Wed Oct 29, 2008 12:34 am    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

I tried to put a message into the QR and it does work. It means that the connectivity is fine. But why can't the QM4 and QM5 use the QR to route the report?.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Wed Oct 29, 2008 12:35 am    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

Quote:
1. Set up appropriate QMAs to route the reply back to QM1, or


Result - no COA.
Back to top
View user's profile Send private message
masteringmq
PostPosted: Wed Oct 29, 2008 1:32 am    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

runmqsc on QM4 and QM5:

DEFINE QALIAS(ANY.QMGR) TARGQ(QM1.REPLY) CLUSTER(CLUS2)

In you java code:

hello_world.replyToQueueName = "ANY.QMGR";
hello_world.replyToQueueManagerName = "QM3"

This will route the COA to QM1.REPLY on QM4 or QM5. Then the COA will be routed to QM1.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Wed Oct 29, 2008 3:58 am    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

It is not working.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Wed Oct 29, 2008 5:12 pm    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

I even check SYSTEM.DEAD.LETTER.QUEUE and found that the currentdepth is 0.
Back to top
View user's profile Send private message
masteringmq
PostPosted: Wed Oct 29, 2008 5:16 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

Perhaps other experts in the room is able to help you. I am sure there is a solution. I will continue to look for a solution.
Back to top
View user's profile Send private message
solomon_13000
PostPosted: Wed Oct 29, 2008 11:39 pm    Post subject: Reply with quote

Master

Joined: 13 Jun 2008
Posts: 284

I created ANY.QUEUE manager. I have no java software on my pc at the present moment but will try later.
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 » Java - Report from MQ
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.