Solved

Java - Report from websphere MQ

Posted on 2008-10-24
14
1,074 Views
Last Modified: 2013-12-11
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?. Did I miss something?.

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) PUT(ENABLED) GET(ENABLED)

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) RQMNAME(QM1) RNAME('') 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) XMITQ(QM1.XMIT) CONNAME('localhost(1420)')

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) RQMNAME(QM1) RNAME(MQ1.REPLY) XMITQ(QM2.XMIT)

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

DEFINE CHANNEL(QM1.QM2.DF) CHLTYPE(SDR) TRPTYPE(TCP) XMITQ(QM2.XMITQ) 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)

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)

runmqlsr -m QM5 -t tcp -p 1418


Your help is kindly appreciated.

Thank You.
0
Comment
Question by:eugene007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 3
14 Comments
 

Author Comment

by:eugene007
ID: 22804236
I did modification on MQ script but still no report is generated.
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

Open in new window

0
 
LVL 5

Expert Comment

by:lgacs
ID: 22816592
You should also define replyToQueueManager beside replyToQueueName
0
 

Author Comment

by:eugene007
ID: 22819299
public String replyToQueueManagerName
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:eugene007
ID: 22820312
I added:

hello_world.replyToQueueManagerName = "QM1";

But no report is return to the queue manager QM1 queue QM1.REPLY
0
 
LVL 5

Expert Comment

by:lgacs
ID: 22820644
You have not received COA because your message has NOT been delivered.

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)

Try a simple structure first.
Make a drawing on it, signing the references and message paths.

0
 

Author Comment

by:eugene007
ID: 22823567
Actually the mq script is a load balancing script. At QM3 it decides to route the message to QM4 or QM5.
0
 

Author Comment

by:eugene007
ID: 22823616
In QM4 and QM5 I have:
DEFINE QREMOTE(QM1.REPLY) RNAME(QM1.REPLY) RQMNAME(QM3) XMITQ('') CLUSTER(CLUS2)
so why cant the QM4 and QM5 use this remote queue to send a COA to QM1?
0
 
LVL 5

Accepted Solution

by:
lgacs earned 150 total points
ID: 22824891
I repeat: You have not received COA because your message has NOT been delivered.
DEFINE QREMOTE(QM1.RQSTIN) RNAME(QM1.RQSTIN) RQMNAME(ANY.QMGR) XMITQ(Q3.XMIT)

The original message is not deliverable, you have no queue manager "ANY.QMGR".
All messages are  transmitted to QM3, where you can find them in the dead letter queue
(which is probably your DEAD.QUEUE, if defined so, or in a default transmission queue
if it is declared.)
0
 

Author Comment

by:eugene007
ID: 22828313
How do I resolve this problem without affecting the load balancing capability of the MQ script?.
0
 

Author Comment

by:eugene007
ID: 22828897
I check the DEAD.QUEUE and Transmission Queue but the current depth is 0.
0
 

Author Comment

by:eugene007
ID: 22830180
I also did the following:

Java code:

hello_world.report = MQC.MQRO_COD ;
hello_world.replyToQueueName = "ANY.QMGR";
hello_world.replyToQueueManagerName = "QM3";

For QM4 and QM5 I:

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

But no report is sent to QM1.
0
 

Author Comment

by:eugene007
ID: 22837348
I even check SYSTEM.DEAD.LETTER.QUEUE and found that the currentdepth is 0.
0
 

Author Comment

by:eugene007
ID: 22837427
ANY.QMGR does not exist, can I declare one with no queue and channel definition declared.
0
 

Author Comment

by:eugene007
ID: 22841479
I did a simple design and it works :)
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question