IBM Integration Bus, Version 9.0.0.8 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

JavaCompute node

Use the JavaCompute node to work with messages by using the Java™ language.

Purpose

By using this node, you can complete the following tasks:

  • Use Java to examine an incoming message and, depending on its content, propagate it unchanged to one of the two output terminals of the node. The node behaves in a similar way to a Filter node, but uses Java instead of ESQL to determine which output terminal to use.
  • Use Java to change part of an incoming message and propagate the changed message to one of the output terminals.
  • Use Java to create and build a new output message that is independent of the input message.
  • Use Java to create a map in a global cache, and to add and retrieve data from that map. By storing data in the global cache, that data is available to other JavaCompute nodes or message flows.

The Java code that is used by the node is stored in an Eclipse Java project.

The Java code that you use to access and manipulate the message data can be coded using any of the following programming styles:
  • Java plugin API
  • Java Architecture for XML Binding (JAXB)
  • Document Object Model (DOM)

The JavaCompute node is contained in the Transformation drawer of the palette, and is represented in the IBM® Integration Toolkit by the following icon:

Compute node icon

Using this node in a message flow

The JavaCompute node uses the same execution model as Java user-defined nodes and therefore the restrictions and assumptions that are associated with Java user-defined nodes also apply to Java code developed for JavaCompute nodes; see Creating a message processing or output node in Java. Only one instance of the JavaCompute node is created regardless of the number of threads that are running against the flow (either as a result of extra instances or multiple input nodes). Therefore, all of your user Java code must be threadsafe and reentrant. For more information, see User-defined extensions execution model and Threading considerations for user-defined extensions.

Double-click the JavaCompute node to open the New Java Compute Node Class wizard. The wizard guides you through the creation of a new Java project and a Java class that contains some skeleton code. This skeleton code is displayed in a Java editor. For more information about creating Java code for a JavaCompute node, and for examples of the skeleton code or template that are provided, see Creating Java code for a JavaCompute node. If it is not the first time that you have double-clicked the node, the Java code is displayed.

The MbJavaComputeNode class contains two methods that you can override: onInitialize() and onDelete(). If you want the node to perform cleanup operations, for example closing sockets, include an implementation of the onDelete method:
public void onDelete()
{
  // perform node cleanup if necessary
}
The onInitialize() method is called either during deployment or on broker startup. During deployment, the method is called before deployment is committed. Other nodes can throw exceptions during their initialization; therefore, the flow fails to deploy, even if the onInitialize() method for this node works. If your onInitialize() method throws an exception, the flow either fails to deploy, or fails to start. Therefore, complete tasks that always work or always fail during the onInitialize() method. The broker does not try to start the flow again until the broker is restarted. If you need to initialize an external connection that might need to be retried, do so on the first message through the flow so that the flow can retry the transaction as necessary.
Look at the following sample to see how to use this node.

You can view information about samples only when you use the product documentation that is integrated with the IBM Integration Toolkit or the online product documentation. You can run samples only when you use the product documentation that is integrated with the IBM Integration Toolkit.

Specifying Java

Code Java statements to customize the behavior of the JavaCompute node. For example, you can customize the node to create a new output message or messages, using input message or database content (unchanged or modified), or new data. For example, you might want to modify a value in the input message by adding a value from a database, and store the result in a field in the output message.

Code the Java statements that you want in a Java file that is associated with the JavaCompute node.

If a Java file does not exist for this node, right-click the JavaCompute node and click Open Java to create and open a new Java file in the Editor view. If the file exists already, click Browse beside the Java Class property to display the JavaCompute Node Type Selection window. When you type at least one character in the Select field, matching Java classes are listed. You can use the asterisk (*) to represent any character as part of a search string; for example, a*b. Select the appropriate Java class and click OK.

Restriction: Do not try to create another instance of a JavaCompute node from Java code; this behavior is not supported.

Java in applications

Earlier versions of WebSphere Message Broker and IBM Integration Bus did not support Java isolation in applications. All Java that was deployed to the integration server (or execution group) was loaded into a single class loader, which was then used by all JavaCompute nodes in all applications. This behavior precluded the use of duplicate classes.

From IBM Integration Bus Version 9.0.0.3, you can now use Java isolation at the application level: A Java class loader is built for each application, and it contains only the Java that is deployed in that application and any included libraries.

You can enable and disable Java isolation for individual applications by setting the Java Isolation configuration property on the Manage tab of the BAR file editor. Java isolation is disabled by default.

Terminals and properties

When you put an instance of the JavaCompute node into a message flow, you can configure it; see Configuring a message flow node. To associate an instance of a JavaCompute node with a Java class, configure the node's properties. The properties of the node are displayed in the Properties view. All mandatory properties for which you must enter a value (those properties that do not have a default value defined) are marked with an asterisk.

The JavaCompute node terminals are described in the following table.

Terminal Description
In The input terminal that accepts a message for processing by the node.
Failure The output terminal to which the input message is routed if a failure is detected during the computation. (Even if the Validate property is set, messages that are propagated to the Failure terminal of the node are not validated.)
Out The output terminal to which the transformed message is routed.
Alternate An alternative output terminal to which the transformed message can be routed, instead of to the Out terminal.

The following tables describe the node properties. The column headed M indicates whether the property is mandatory (marked with an asterisk if you must enter a value when no default is defined); the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the BAR file to deploy it).

The Description properties of the JavaCompute node are described in the following table.

Property M C Default Description
Node name No No The node type: JavaCompute The name of the node.
Short description No No   A brief description of the node.
Long description No No   Text that describes the purpose of the node in the message flow.

The Basic properties for the JavaCompute node are described in the following table.

Property M C Default Description
Java class Yes No None The name of the Java class that is used in this node. This name must be displayed in the list of Java classes that are available in the project references for the integration project.

To select a file that exists, click Browse. When you type at least one character in the Select field, matching Java classes are listed. You can use the asterisk (*) to represent any character as part of a search string; for example, a*b. Select the appropriate Java class and click OK.

Java classloader service No Yes None The name of the JavaClassLoader configurable service that is used in this node. If no name is specified, and a if JavaClassLoader configurable service with the same name as the integration server exists, it is used in this node. Otherwise, no JavaClassLoader configurable service is used.

All the nodes in an integration server that specify the same JavaClassLoader configurable service use the same instance of the classloader. So all the nodes use the same in-memory version of the classes, including access to the same static variables.

For more information, see JavaCompute node classloading.

The Parser Options properties for the JavaCompute node are described in the following table.

Property M C Default Description
Use XMLNSC Compact Parser for XMLNS Domain No No Cleared Setting this property causes the outgoing MQRFH2 to specify the XMLNS instead of XMLNSC parser, allowing an external application to remain unchanged. If outgoing messages do not contain MQRFH2 headers, this property has no effect.

The Validation properties of the JavaCompute node are described in the following table.

Set the validation properties to define how the message that is produced by the JavaCompute node is validated. These properties do not cause the input message to be validated. It is expected that, if such validation is required, the validation has already been performed by the input node or a preceding validation node. For more details, see Validating messages and Validation properties.

Property M C Default Description mqsiapplybaroverride command property
Validate No Yes None This property controls whether validation takes place, and what part of the message is validated. Valid values are None, Content and Value, Content, and Inherit. validateMaster
Failure action No No Exception This property controls what happens if a validation failure occurs. You can set this property only if Validate is set to Content or Content and Value. Valid values are User Trace, Local Error Log, Exception, and Exception List.  
The Monitoring properties of the node are described in the following table.
Property M C Default Description
Events No No None Events that you have defined for the node are displayed on this tab. By default, no monitoring events are defined on any node in a message flow. Use Add, Edit, and Delete to create, change or delete monitoring events for the node; see Configuring monitoring event sources using monitoring properties for details.

You can enable and disable events that are shown here by selecting or clearing the Enabled check box.


ac20805_.htm | Last updated Friday, 21 July 2017