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 » Propagate messages in Javacompute Node

Post new topic  Reply to topic
 Propagate messages in Javacompute Node « View previous topic :: View next topic » 
Author Message
anild
PostPosted: Tue Apr 28, 2009 5:25 am    Post subject: Propagate messages in Javacompute Node Reply with quote

Novice

Joined: 19 Sep 2007
Posts: 13

Hi,

I am trying to propagate messages with in java compute node using for loop as
public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbMessage inMessage = contact admin.getMessage();
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin, outMessage);
copyMessageHeaders(inMessage, outMessage);
try {
for (int i = 0; i < 3; i++) {
MbElement xmlnsc = outMessage.getRootElement().createElementAsLastChild("XMLNSC");
xmlnsc.createElementAsLastChild(MbXMLNSC.FOLDER, "Sample" + i, null);
getOutputTerminal("out").propagate(outAssembly);
outMessage.clearMessage();
}
} catch (Exception e) {
e.printStackTrace();
}
}


But each time it is propagating only 1 message instead of 3. It is not giving me any errors but I think that the control is not returned to Java Compute Node once the propagate function is called.

So, I wanted to check if we can use propagate statement with in loop constructs in Java Compute Node.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Apr 28, 2009 5:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

There's nothing obviously wrong with your loop. So if it is failing to loop, and you haven't actually demonstrated that (perhaps you should take a usertrace), then it is caused by something other than your use of propagate.

The rest of the code, however, probably doesn't do what you think it does.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Apr 28, 2009 5:54 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

do you need to reinitialise the out message inside the loop as its been cleared when the loop enters the 2nd and 3rd iterations.

Just a thought
Back to top
View user's profile Send private message
anild
PostPosted: Tue Apr 28, 2009 5:59 am    Post subject: Reply with quote

Novice

Joined: 19 Sep 2007
Posts: 13

Hi,

I think that it might not be the issue. As long as you don't assign the outMessage to null it will not require reinitializing.

WMBDEV1 wrote:
do you need to reinitialise the out message inside the loop as its been cleared when the loop enters the 2nd and 3rd iterations.

Just a thought
Back to top
View user's profile Send private message
sknrt1
PostPosted: Tue Apr 28, 2009 7:18 am    Post subject: Reply with quote

Apprentice

Joined: 22 Jan 2003
Posts: 39
Location: USA

Hi anild,
You have to re-initialize outMessage, (as suggested by WMBDEV1), default behaviour of propagation is to clear outmessage (outputroot), which you can override by using DEFAULT NONE flag of the PROPAGATE statement (explore how to set the same in java compute node). So, try to move the initialization code into the loop and you can see the result.

Thanks
_________________
------------------------------------------
sk
MQ User since 2001
Message Broker User since 2001

IBM Certified
Solution Designer - WebSphere MQ
Solution Developer - Message Broker
Back to top
View user's profile Send private message
anild
PostPosted: Mon May 04, 2009 3:05 am    Post subject: Reply with quote

Novice

Joined: 19 Sep 2007
Posts: 13

Hi,

We have tried the same. But as mentioned earlier, the problem was not due to intialization but due to the control not returning to JavaCompute node after calling propagate on out terminal. Hence the initialization code has no effect what so ever as it is not getting invoked the second time.

sknrt1 wrote:
Hi anild,
You have to re-initialize outMessage, (as suggested by WMBDEV1), default behaviour of propagation is to clear outmessage (outputroot), which you can override by using DEFAULT NONE flag of the PROPAGATE statement (explore how to set the same in java compute node). So, try to move the initialization code into the loop and you can see the result.

Thanks
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Mon May 04, 2009 6:05 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Where does the message go next in the flow? You have propagated the message so maybe it is locking up somewhere further down the flow.

I seem to remember once when we were looking at something dealing with propagating a message numerous times that the thread running the JCN processes the propagated message to it's endpoint before coming back to the loop.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Propagate messages in Javacompute Node
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.