Skip to content

WebSphere Message Broker (WMB) – Using Local Environment

by on August 20, 2013

This blog post will show how we can use the Local Environment in WebSphere Message Broker Version 7 (WMB v7) to set file names for flows using the File Output Node (Part 2 will demonstrate in v8). This technique has many different uses. What this blog demonstrates is an example of how to set the file name in Compute Node using ESQL and then preserving the setting as the message propagates through a compute node and mapping node.

The message flow for this example is a simple, but important scenario that many of our consultants and clients have to implement very often.  This example will consist of a File Input Node, Compute Node to set the output file name, mapping node demonstrating how to copy Local Environment, and finally the File Output node.

Here is the message flow:

blog-localenv-messageflow-v7

 

 

 

 

 

 

 

 

The following steps will outline the customizations made to the above flow to ensure the File Name is set and propagated through the message flow properly.

1.  Make sure the properties of the Compute node and the mapping node have their modes set to LocalEnvironment and Message:

blog-localenv-v7-compute-properties

 

 

 

 

 

2.  In this simple example, we do the following 3 things in the Compute Node: 

  1.  Declare the character string for the file name
  2. Set the text of the filename to that string
  3. Set the Local Environment where the file name is stored to the string we created

 

blog-localenv-v7-compute-esql

 

3.   By default, WMB mapping node does not pass the Local Environment.  In order to do this, you need to add the Local Environment to the source and target message structures and then map this from input to output.   To do this right-click source inside the mapping node.  From that list select Add or Remove Headers or Folders:

blog-localenv-v7-mapping-add-localenv1

 

4.  From this window select Local Environment and click Ok

blog-localenv-v7-mapping-add-localenv2

 

5.  Now repeat the same thing for the target side of the mapping

 

6.  Drag the source Local Environment to the target Local Environment

blog-localenv-v7-mapping

 

This completes the customization of the message flow.  The output of this flow will now have the File Name that was specified in the Compute Node.

blog-localenv-v7-final-output

 

The Local Environment’s function is to store key information during message flow processing.   As seen in this post, the Local Environment can be used to set a file name from in a Compute Node using ESQL.  This can also be accomplished in Java Compute Node and the Mapping Node itself.   

Thank you to our consultant Adam Tzikas for his contributions to this post.

Thank you,

TransformaTech

Advertisements

From → Integration

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: