|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
copyEntireMessage using Java Compute Node |
« View previous topic :: View next topic » |
Author |
Message
|
Maverik |
Posted: Fri Jun 09, 2006 5:43 am Post subject: copyEntireMessage using Java Compute Node |
|
|
Apprentice
Joined: 14 Jun 2005 Posts: 27
|
I am trying to do a copyEntireMessage using the Java compute node... it is throwing a parser could not be created error...can someone tell me how to fix this code.
Code: |
public void copyEntireMessage(MbMessage inMessage, MbMessage outMessage, String parser)
throws MbException {
MbElement outRoot = outMessage.getRootElement();
// iterate though the headers starting with the first child of the root
// element
MbElement header = inMessage.getRootElement().getFirstChild();
while (header != null && header.getNextSibling() != null)
{
// copy the header and add it to the out message
outRoot.addAsLastChild(header.copy());
// move along to next header
header = header.getNextSibling();
}
header = outRoot.createElementAsLastChild(parser);
header = outRoot.createElementAsLastChild(MbElement.TYPE_NAME);
header = inMessage.getRootElement().getLastChild();
outRoot.addAsLastChild(header.copy());
} |
Except for the last four lines, the rest is from the copyMessageHeaders and works ok...the line with the parser was also ok, but if i exit after that line, i find that the last child is empty...i want to copy the input message to the output.
Please help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 09, 2006 8:41 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You seem to go about it in a roundabout way.
How about
Code: |
outMessage = inMessage; |
Now what you did is nice and details the copying of the headers.
By the way you can use the same to copy the body.
Adhere to the KISS principle. Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Jun 10, 2006 5:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jun 10, 2006 2:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Thanks Jeff Learning new things every day.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Maverik |
Posted: Sat Jun 10, 2006 7:17 pm Post subject: |
|
|
Apprentice
Joined: 14 Jun 2005 Posts: 27
|
Sorry, realised it too late...i was not able to debug the flow, finally when something came out of the compute it had two properties, two MQMD's...that's when it sparked...
Thanks everyone. |
|
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
|
|
|
|