|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to remove MQMD header within MbMessageAssembly |
« View previous topic :: View next topic » |
Author |
Message
|
Mohit Gupta |
Posted: Wed Nov 17, 2004 10:35 pm Post subject: How to remove MQMD header within MbMessageAssembly |
|
|
Apprentice
Joined: 16 Sep 2004 Posts: 34
|
Hi,
I have written a java plugin custom node which extends MbNode and implements MbNodeInterface. In the evaluate method i am getting the bytes of the message MbMessage msg = arg0.getMessage();
byte[] bitstream = msg.getBuffer();
then i pass this byte array or write it out to the output device but i get some characters on the first line definitely its the message header . I want to skip the message header only message body how do i achieve that.
Cheers,
Mohit |
|
Back to top |
|
 |
kishoreraju |
Posted: Thu Nov 18, 2004 4:44 am Post subject: |
|
|
Disciple
Joined: 30 Sep 2004 Posts: 156
|
why don't you try to make them Null before coming to the plugin node.is thre any problem to do like this
OutputRoot.MQMD=null; |
|
Back to top |
|
 |
kirani |
Posted: Thu Nov 18, 2004 12:39 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Your MessageBuffer will include Properties, MQMD and Data sections. In your plug-in node you need to first get a reference to "Data" part and then create a bitstream out of it. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
Mohit Gupta |
Posted: Thu Nov 18, 2004 9:45 pm Post subject: |
|
|
Apprentice
Joined: 16 Sep 2004 Posts: 34
|
Kishore if i set the OutputRoot.Properties and OutputRoot.MQMD to NULL then broker is throwing an exception and i want to extract some info from the message header like timestamp , filename , batch id etc.
So i have to first read mqmd extract some info and then pass the data alongwith the info from MQMD.
Kirani that's the problem i am facing how to extract Properties , MQMD and Data part out of the buffer. if you see the evaluate method it accepts MbMessageAssembly which gives four methods getExceptionList , getLocalEnvironment , getGlobalEnvironment and getMessage. within getMessage i got the entire message containing Properties and MQMD , now assembly.getMessage returns Message object which doesn't give the methods to extract Properties and MQMD.
Although i manage to do in a dirty way like this..
public void evaluate(MbMessageAssembly arg0, MbInputTerminal arg1)
throws MbException {
MbMessage msg = arg0.getMessage();
byte[] msgdata = msg.getBuffer();
String data = new String(msgdata);
// starting point of my data
int pos = data.indexOf("1,");
data = data.substring(pos);
byte[] bitstream = data.getBytes();
}
Cheers,
Mohit |
|
Back to top |
|
 |
kirani |
Posted: Thu Nov 18, 2004 11:41 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Yes, it does. You have to use MbElement class. You can search an element by name also.
Take a look at the sticky on the top of this forum. You will find links to some very good Redbooks, which explain plug-in nodes at very detailed level. They also provide some sample code. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
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
|
|
|
|