|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Java plugin, RouteToLabel and Environment tree |
« View previous topic :: View next topic » |
Author |
Message
|
fitzcaraldo |
Posted: Sun Oct 05, 2003 3:52 am Post subject: Java plugin, RouteToLabel and Environment tree |
|
|
Voyager
Joined: 05 May 2003 Posts: 98
|
Hi,
I have a flow where I propagate a message to a RouteToLabel flow in which I use a custom written Java plugin to retrieve the QueueManager name and write it to the Environment tree. A trace node immediately following the Java node confirms that the plugin is working as expected and the QueueManager name has been correctly written to the Environment tree. The RouteToLabel flow stops at this point with the idea being that control flows back to the compute node that issued the RouteToLabel so that the retrieved Queue Manager name for further processing. The problem is that when control returns to the Compute node, the changes made to the Environment tree have disappeared. Interestingly, if I use ESQL instead to populate the Environment tree in the RouteToLabel flow, the changes are preserved on return to the controlling node.
Am I missing something? |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Oct 05, 2003 5:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What does your code to populate the Environment look like? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fitzcaraldo |
Posted: Sun Oct 05, 2003 1:46 pm Post subject: |
|
|
Voyager
Joined: 05 May 2003 Posts: 98
|
Thanks Jeff,
Here's the evaluate method.
-MQ 5.3/WMQI 2.1(CSD5)/XP
Code: |
public void evaluate(MbMessageAssembly assembly, MbInputTerminal in)
throws MbException {
// create the new outgoing message
MbMessage outMsg = new MbMessage(assembly.getMessage());
MbMessage outLEnv = new MbMessage(assembly.getLocalEnvironment());
MbMessage outEnv = new MbMessage(assembly.getGlobalEnvironment());
MbMessage outExc = new MbMessage(assembly.getExceptionList());
MbMessageAssembly outAssembly = new MbMessageAssembly(assembly,outLEnv,outEnv,outExc,outMsg);
// retrive the queue manager name
String qmgrname = getBroker().getQueueManagerName();
// get the GlobalEnvironment
MbElement envElement = outAssembly.getGlobalEnvironment().getRootElement();
// find or create the right element element
MbElement varElem = envElement.getFirstElementByPath("./myElement");
if (varElem == null) {
varElem = envElement.createElementAsLastChild(MbElement.TYPE_NAME);
varElem.setName("myElement");
}
// find or create the QueueMangaerName element
MbElement qmnElem= varElem.getFirstElementByPath("./QueueManagerName");
if (qmnElem == null) {
qmnElem = varElem.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE);
qmnElem.setName("QueueManagerName");
qmnElem.setValue(qmgrname);
} else {
qmnElem.setValue(qmgrname);
}
// get the output terminal
MbOutputTerminal out = getOutputTerminal("out");
// Now propagate the message assembly.
// If the terminal is not attached, an exception will be thrown. The user
// can choose to handle this exception, but it is not neccessary since
// the framework will catch it and propagate the message to the failure
// terminal, or if it not attached, rethrow the exception back upstream.
out.propagate(outAssembly);
}
}
|
|
|
Back to top |
|
 |
fitzcaraldo |
Posted: Sun Oct 05, 2003 4:39 pm Post subject: |
|
|
Voyager
Joined: 05 May 2003 Posts: 98
|
Found my problem.
I should not copy the GlobalEnvironment as shown but should use the existing one. Pretty obvious when I think about it.
Code: |
// MbMessage outEnv = new MbMessage(assembly.getGlobalEnvironment());
MbMessage outEnv = assembly.getGlobalEnvironment();
|
|
|
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
|
|
|
|