Author |
Message
|
gajanank |
Posted: Tue Dec 04, 2007 9:49 pm Post subject: Setting right corelation id |
|
|
Newbie
Joined: 04 Dec 2007 Posts: 1
|
I am new to MQ so pardon me if this looks very simple.
Scenario
1. Lotus Notes Application receives message from other MQ application
2. Lotues Notes Java agent processes the MQMessage and sends the reply back to sender application.
Problem
When sending reply back , client application expects message id of the original message copied to coorelation id of message which my application should be sending.
However coorelation id is not getting copied correctly.
MQMessage mqMsg = new MQMessage();
mqMsg.format = MQC.MQFMT_STRING;
mqMsg.messageId = messageID.getBytes();
mqMsg.correlationId = messageID.getBytes();
mqMsg.characterSet = 1208;
mqMsg.report = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
mqMsg.writeString(message);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID ;
System.out.println("before sending message");
qName.put(mqMsg, pmo);
System.out.println("message successfully sent");
mqMsg.correlationId = mqMsg.messageId;
messageId = new String(mqMsg.messageId);
System.out.println(" Message id of received message is "+ messageID );
System.out.println(" Coorealtion id of sent message is "+ toHexString(mqMsg.correlationId) );
message id of receiving message is not same as coorelation id of message I am sending?
am I missing something here? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 05, 2007 1:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
I am new to Java so pardon me if I make a simple mistake.
If the code you quote is, as I believe, the Lotus Notes Java trying to do the reply there's no reference to the received message. The correl id seems to be set from the message id following the put.
Also never treat either the message id or the correl id as a string. It's a byte array and should certainly be copied as such to prevent conversion, and printed as a hex string.
Have you looked at any of the sample code provided? It may offer useful insights into your requirement. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Wed Dec 05, 2007 2:55 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Do not set a Report Option value in the Put Message Options.
The only PMO you need is to set MQPMO_NO_SYNCPOINT (which is the default on non-mainframes although best practice to explicitly set). |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Dec 05, 2007 4:21 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
You should set MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID in the MQMD's Report field.
And then the Lotus Notes Java agent process has to respect that field and take the appropriate action when building the reply message based off of you request message. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 05, 2007 5:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
In base MQ doesn't he also have to set the pmo option Set CorrelID ??  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|