|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Truncate JMS Header for MQ Message |
« View previous topic :: View next topic » |
Author |
Message
|
jorro004 |
Posted: Sat May 24, 2008 12:12 pm Post subject: Truncate JMS Header for MQ Message |
|
|
Acolyte
Joined: 25 Aug 2007 Posts: 50
|
Hi Folks,
I have two message flows, one which pubishes using the following code
SET OutputRoot.MQMD.CodedCharSetId = 1208;
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2;
SET OutputRoot.MQMD.MsgType = MQMT_DATAGRAM;
SET OutputRoot.MQRFH2.psc.Command = 'Publish';
SET OutputRoot.MQRFH2.psc.Topic = 'Test';
SET OutputRoot.MQRFH2.psc.PubOpt = 'Local' ;
SET OutputRoot.MQRFH2.CodedCharSetId = 1208;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Version = 2;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = MQFMT_STRING ;
SET OutputRoot.MQRFH2.(MQRFH2.Field)NameValueCCSID = 1208;
SET OutputRoot.XMLNS = InputRoot.XMLNS ;
Second a Subcriber flow which has JMSInput Node for subscribing and dumps the JMS Message to queue.
Now, I'm trying to truncate the JMS Header after the JMSInput node in subscriber flow using compute node by following code
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Transactional = TRUE ;
SET OutputRoot.MQMD.Format = 'MQSTR' ;
SET OutputRoot.MQMD.Encoding = 273 ;
SET OutputRoot.MQMD.CodedCharSetId = 1208 ;
SET OutputRoot.MQRFH2 = NULL ;
SET OutputRoot.XMLNS = InputRoot.(0x01000010)ParserRoot.XMLMessage ;
When I do this, I could see message truncated well in Trace file, But I dont see any message on queue.
Am I missing any property for which it doesnt allow to put message on queue?
Please advise ?
Thanks |
|
Back to top |
|
 |
smdavies99 |
Posted: Sat May 24, 2008 11:24 pm Post subject: You seem a bit confused |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
1) Using the "Copy Message Headers" function will already copy the MQMD to the OutputRoot tree.
2) SET OutputRoot.MQMD.Transactional = TRUE ;
I don't think this is a valid field in the MQMD
3) Before someone like Kimbert adds,
Use the XMLNSC Parser
4) To remover the RFH2 Header you just need to do
SET OutputRoot.MQMD.Format = MQFMT_STRING ;
SET OutputRoot.MQRFH2 = NULL ;
Better sill, don't copy it in the first place...
5) This could do with an explanation
SET OutputRoot.XMLNS = InputRoot.(0x01000010)ParserRoot.XMLMessage ; _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun May 25, 2008 7:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
To add to smdavies99's advice,
Copy the whole message, do not change from standard CopyEntireMessage function, it is confusing and will impact maintainability...
You need to get to the header immediately following the MQMD (should be RFH2) and get the format, ccsid and encoding and set them on the MQMD, then you can delete it. (header chaining)
I do understand that if your message is a text message smdavies99's simpler method will work...in most cases.
Enjoy  _________________ MQ & Broker admin |
|
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
|
|
|
|