Before you start
WebSphere Message Broker provides the source for two sample user-defined nodes called SwitchNode and TransformNode. You can use these nodes in their current state, or you can modify them.
Do not develop Java nodes on z/OS that you intend to deploy to a broker on a distributed platform. This is because the level of Java on z/OS might not produce code that is compatible with the level of Java on the distributed platform.
The Java Settings panel is displayed.
Any class that implements the MbInputNodeInterface, and is contained in the broker's classpath (or LIL path) is registered with the broker as an input node. When you implement the MbInputNodeInterface, you also need to implement a run method for this class. The run method represents the start of the message flow, contains the data that formulates the message, and propagates it down the flow. The broker calls the run method when threads become available in accordance with your specified threading model.
For example, to declare the input node class:
package com.ibm.jplugins; import com.ibm.broker.plugin.*; public class BasicInputNode extends MbInputNode implements MbInputNodeInterface { ...
When the node is instantiated, the constructor of the user's node class is called. This is where you create the terminals of the node, and initialize any default values for the attributes.
An input node has a number of output terminals associated with it, but does not typically have any input terminals. Use the createOutputTerminal method to add output terminals to a node when the node is instantiated. For example, to create a node with three output terminals:
public BasicInputNode() throws mbException { createOutputTerminal ("out"); createOutputTerminal ("failure"); createOutputTerminal ("catch"); setAttribute ("firstParserClassName","myParser"); attributeVariable = new String ("none"); }
You need to declare the name of the node as it will be identified by the workbench. All node names must end with "Node". You declare the name using the following method:
public static String getNodeName() { return "BasicInputNode"; }
package com.ibm.pluginsamples; public class BasicInputNode extends MbInputNode implements MbInputNodeInterface { ...
You declare node attributes in the same way as Java Bean properties. You are responsible for writing getter and setter methods for the attributes, and the API framework infers the attribute names using the Java Bean introspection rules. For example, if you declare the following two methods:
private String attributeVariable; public String getFirstAttribute() { return attributeVariable; } publc void setFirstAttribute(String value) { attributeVariable = value; }
The broker infers that this node has an attribute called firstAttribute. This name is derived from the names of the get or set methods, not from any internal class member variable names. Attributes can only be exposed as strings, so you must convert any numeric types to and from strings in the get or set methods. For example, the following method defines an attribute called timeInSeconds:
int seconds; public String getTimeInSeconds() { return Integer.toString(seconds); } public void setTimeInSeconds(String value) { seconds = Integer.parseInt(value); }
As already described, the run method is called by the broker to create the input message. This method should provide all the processing function for the input node.
An input node implementation normally determines what message parser initially parses an input message. For example, the primitive MQInput node dictates that an MQMD parser is required to parse the MQMD header. A user-defined input node can select an appropriate header or message parser, and the mode in which the parsing is controlled, by using the following attributes that are included as default, which you can override:
You implement the onDelete method as follows:
public void onDelete() { // perform node cleanup if necessary }
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
as09950_ |