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 » WebSphere Message Broker (ACE) Support » Truncate JMS Header for MQ Message

Post new topic  Reply to topic
 Truncate JMS Header for MQ Message « View previous topic :: View next topic » 
Author Message
jorro004
PostPosted: Sat May 24, 2008 12:12 pm    Post subject: Truncate JMS Header for MQ Message Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Sat May 24, 2008 11:24 pm    Post subject: You seem a bit confused Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sun May 25, 2008 7:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Truncate JMS Header for MQ Message
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.