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 to Label Java

Post new topic  Reply to topic
 Propagate to Label Java « View previous topic :: View next topic » 
Author Message
rsandoz
PostPosted: Tue Dec 05, 2006 8:15 am    Post subject: Propagate to Label Java Reply with quote

Novice

Joined: 12 Oct 2006
Posts: 17

I am currently using MB6 with a JavaComputeNode. Is there a way to do PROPAGATE TO LABEL from Java? I also explored using terminals to do something similar. All I have are terminals out, failure and alt. Is there a way to add another terminal? (I noticed the method createOutputTerminal)
Back to top
View user's profile Send private message
Bill.Matthews
PostPosted: Tue Dec 05, 2006 11:51 am    Post subject: Re: Propagate to Label Java Reply with quote

Master

Joined: 23 Sep 2003
Posts: 232
Location: IBM (Retired)

rsandoz wrote:
I am currently using MB6 with a JavaComputeNode. Is there a way to do PROPAGATE TO LABEL from Java? I also explored using terminals to do something similar. All I have are terminals out, failure and alt. Is there a way to add another terminal? (I noticed the method createOutputTerminal)


The ability to do a Propagate to LABEL from a JavaCompute node was added to the Broker runtime in FP3 (v6.0.0.3).
_________________
Bill Matthews
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Dec 05, 2006 11:57 am    Post subject: Re: Propagate to Label Java Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Bill.Matthews wrote:
The ability to do a Propagate to LABEL from a JavaCompute node was added to the Broker runtime in FP3 (v6.0.0.3).


It appears that the InfoCenter has not been updated to indicate how this is done, at least in the Java API documentation for the propagate method.

Nor does it appear to be in the readme.html.

Care to share some code, Bill?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
rsandoz
PostPosted: Tue Dec 05, 2006 1:16 pm    Post subject: Reply with quote

Novice

Joined: 12 Oct 2006
Posts: 17

I did find two links that led me to believe that this was possible:

http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=13884637&cat=9&thread=121672&treeDisplayType=threadmode1&forum=281#13884637

and

http://www-128.ibm.com/developerworks/websphere/library/techarticles/0605_crocker/0605_crocker.html

and put in my java code:
Code:
         MbMessage localEnv = new MbMessage(contact admin.getLocalEnvironment());
         localEnv.getRootElement().createElementAsLastChild(MbElement.TYPE_NAME, "Destination", null)
                            .createElementAsLastChild(MbElement.TYPE_NAME, "RouterList", null)
                            .createElementAsLastChild(MbElement.TYPE_NAME, "DestinationData", null)
                            .createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "labelname", "TERMINATE");
         getOutputTerminal("out").propagate(contact admin);
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Dec 05, 2006 1:17 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Did it work?

Or are you not at 6.0.0.3 of the Runtime?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
rsandoz
PostPosted: Tue Dec 05, 2006 1:27 pm    Post subject: Reply with quote

Novice

Joined: 12 Oct 2006
Posts: 17

No, but I have further progressed. I have something "working", but now something strikes as illogical. evaluateXPath seems to be able to "write" into the XML where createElementAsLastChild does not.

Code:

   public void evaluate(MbMessageAssembly contact admin) throws MbException {
      System.out.println("Starting");
      try {
         MbMessage outMessage = new MbMessage(contact admin.getMessage());
         MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin, outMessage);


           //works fine
         outAssembly.getLocalEnvironment().getRootElement()
            .evaluateXPath("/?Destination/?RouterList/?DestinationData/?LabelName[set-value('TERMINATE')]");
         
           // should work the same as above, but rather throws com.ibm.broker.plugin.MbReadOnlyMessageException
         /*outAssembly.getLocalEnvironment().getRootElement()
            .createElementAsLastChild(MbElement.TYPE_NAME, "Destination", null)
            .createElementAsLastChild(MbElement.TYPE_NAME, "RouterList", null)
            .createElementAsLastChild(MbElement.TYPE_NAME, "DestinationData", null)
            .createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "labelname", "TERMINATE");*/
          

         getOutputTerminal("out").propagate(outAssembly);
          outMessage.clearMessage();
         
      } catch (Exception e){
         e.printStackTrace();
      }
      System.out.println("Finishing");
   }


So in short, I have something working now, but I am feeling a little uncertainty in the solution.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Dec 05, 2006 1:33 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Quote:
# Make a new copy of the local environment to update it. Use the full version of the copy constructor to create a new MbMessageAssembly object, as shown in the following example:

MbMessage env = assembly.getLocalEnvironment();
MbMessage newEnv = new MbMessage(env);

newEnv.getRootElement().createElementAsFirstChild(
MbElement.TYPE_NAME_VALUE,
"Status",
"Success");

MbMessageAssembly outAssembly = new MbMessageAssembly(
assembly,
newEnv,
assembly.getGlobalEnvironment(),
assembly.getExceptionList(),
assembly.getMessage());

getOutputTerminal("out").propagate(outAssembly);


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
rsandoz
PostPosted: Tue Dec 05, 2006 1:54 pm    Post subject: Reply with quote

Novice

Joined: 12 Oct 2006
Posts: 17

Thanks, works great. One minor issue. Eclipse was complaining deprecation. Just removed the getExceptionList parameter and all was perfect.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Dec 05, 2006 1:57 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

That code was from http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac30470_.htm

So if it really produces deprecation warnings in WMBT, please click the "feedback" button at the bottom of the frame and provide details in the web form.
_________________
I am *not* the model of the modern major general.
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 to Label Java
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.