|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JMS and MQSI inteoperability |
« View previous topic :: View next topic » |
Author |
Message
|
pauillac |
Posted: Sat Nov 03, 2001 7:12 am Post subject: |
|
|
Novice
Joined: 13 Jul 2001 Posts: 21
|
Hi,
I have a JMS Client sending an MQSeries message as MQMD-MQRFH2-Payload. (The property TargetClient is set to JMS by default and this makes the message sent by JMS application with MQRFH2 included.) The JMS application set its own Correlation ID -e.g. '00001' (String) and this is stored in MQRFH2 NameValueData as 00001.
I encounter 2 problems:
1. I cannot set MQMD.CorrelId to "00001" (String) in MQSI because in MQSI type casting of a string to BLOB is not for converting a string to its byte represenation, e.g.
it is not for "00001" -> 303030303100000000000000000000000000000000000000 (for MQMD.CorrelId) conversion.
It is for "303030303100000000000000000000000000000000000000" (String) to 303030303100000000000000000000000000000000000000 (Byte)
Please tell me if there is any way to convert the string "00001" to a BLOB type that can be inserted into MQMD.CorrelId in MQSI.
2. If I can overcome the above problem, there is still another hurdle to jump over. If the reply message is retrieved by a JMS application, the correlation ID returned by getJMSCorrelationID is "303030303100000000000000000000000000000000000000" (String) instead of "00001". After some experimentation, I found that if the correlation ID is stored in MQRFH2 NameValueData as 00001, the getJMSCorrelationID() call will return "00001". If I stored it in MQMD (with the queue property TargetClient set to MQSeries Application Type to eliminate MQRFH2), the getJMSCorrelationID() call will return "303030303100000000000000000000000000000000000000" (String).
Under these restrictions, is it possible to construct a MQRFH2 header in MQSI that can be understood by JMS application so that it can retrieve the CorrelationID as "00001" instead of "303030303100000000000000000000000000000000000000" (String)? I would be grateful if anyone who can give me some sample ESQL code for this purpose, for I have tried many times to no avail.
Thank you for your kind attention.
|
|
Back to top |
|
 |
KSkelton |
Posted: Fri Nov 09, 2001 7:10 am Post subject: |
|
|
Apprentice
Joined: 28 Oct 2001 Posts: 45
|
Here is some code I wrote to fill the CorrelID on a message using MQSI. Hope this helps.
----------
The CorrelId in the MQ message header is a 24 byte hexadecimal field which can be used for "getting" data off of a queue. You may want to set the CorrelId with some piece of data from the message. MQSI does not have a built-in way of transforming string data into hex data.
Here is an example of converting numeric data into a hex byte stream to be moved into the CorrelId.
This code is not needed for normal moves of the MsgId into the CorrelId.
-- Move ext.ref.id field into the Correl_Id. Correl_Id must be 24 bytes of Hex data (BLOB format).
DECLARE V_CORREL_CHAR CHAR;
DECLARE V_CORREL_HEX CHAR;
DECLARE V_BYTE CHAR;
DECLARE V_LENGTH INTEGER;
DECLARE V_I INTEGER;
SET V_CORREL_CHAR = InputRoot.XML."dexma.rso"."client.info"."ext.ref.id";
SET V_LENGTH = LENGTH(V_CORREL_CHAR);
SET V_CORREL_HEX = '';
-- Convert data into hex.
SET V_I = 1;
WHILE V_I <= 24 DO
IF V_I <= V_LENGTH THEN
SET V_BYTE = '3' || SUBSTRING(V_CORREL_CHAR FROM V_I FOR 1);
ELSE
SET V_BYTE = '00';
END IF;
SET V_CORREL_HEX = V_CORREL_HEX || V_BYTE;
SET V_I = V_I + 1;
END WHILE;
SET OutputRoot.MQMD.CorrelId = CAST(V_CORREL_HEX AS BLOB); |
|
Back to top |
|
 |
EddieA |
Posted: Fri Nov 09, 2001 8:52 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Hi,
The previous answer will allow you to set the CorrelationID as a byte value. Note, that you can only use the digits 0-9, not a-f.
Then, in answer to your point 2. Use getJMSCorrelationIDAsBytes to get a byte array of the value returned to you. That will contain the '00001' you wanted.
Cheers,
_________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|