Creating a simple filter by using a JavaCompute node
The JavaCompute node has two output terminals: Out and Alternate. To use the JavaCompute node as a filter node, propagate a message to either the Out or Alternate terminal based on the message content.
Before you begin
To complete this task, you must have added a JavaCompute node to your message flow.
About this task
Procedure
public class jcn2 extends MbJavaComputeNode {
public void evaluate(MbMessageAssembly assembly) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage message = assembly.getMessage();
// ----------------------------------------------------------
// Add user code below
// End of user code
// ----------------------------------------------------------
// The following should only be changed
// if not propagating message to the 'out' terminal
out.propagate(assembly);
}
}
The template produces a partial implementation of a method called evaluate(). The integration node calls evaluate() once for each message that passes through the node. The parameter that is passed to evaluate() is the message assembly. The message assembly encapsulates the message that is passed on from the previous node in the message flow.
Add custom code to the template, and propagate messages to both the Out and Alternate terminals to create a message filter.