WebSphere Message Brokers
File: ac16840_
Writer: Bill Oppenheimer

Task topic

This build: July 31, 2007 21:18:41

Accessing the Environment tree

The Environment tree has its own correlation name, Environment, and you must use this in all ESQL statements that refer to or set the content of this tree.

The Environment tree is always created when the logical tree is created for an input message. However the message flow neither populates it nor uses its contents. You can use this tree for your own purposes, for example to pass information from one node to another. You can use the whole tree as a scratchpad or working area.

The advantage of creating your own data in Environment is that this data is propagated as part of the logical tree to subsequent nodes in the message flow. If you create a new output message in a Compute node, the Environment tree is also copied from the input message to the new output message. (This is in contrast to the LocalEnvironment tree, which is only included in the output message if you explicitly request that it is).

Only one Environment tree is present for the duration of the message flow. Any data updates or additions that you make in one node are retained and all nodes in the message flow have access to the latest copy of this tree. Even if the message flows back through the message flow (for example, if an exception is thrown, or if the message is processed through the second terminal of the FlowOrder node), the latest state is retained.

This is in contrast to the LocalEnvironment tree, which reverts to its previous state if the message flows back through the message flow.

You can use this tree for any purpose you choose. For example, you could use the following ESQL statements to create fields in the tree:
SET Environment.Variables = 
      ROW('granary' AS bread, 'reisling' AS wine, 'stilton' AS cheese);
SET Environment.Variables.Colors[] = 
      LIST{'yellow', 'green', 'blue', 'red', 'black'};
SET Environment.Variables.Country[] = LIST{ROW('UK' AS name, 'pound' AS currency),
   	 ROW('USA' AS name, 'dollar' AS currency)};

This information is now available to all nodes to which a message is propagated, regardless of their relative position in the message flow.

For another example of how you can use Environment to store information used by other nodes in the message flow, refer to the Reservation message flow in the Airline Reservations sample. The Compute node in this message flow writes information to the subtree Environment.Variables that it has extracted from a database according to the value of a field in the input message. You can view samples only when you use the information center that is integrated with the Message Brokers Toolkit.

Related concepts
Message flows overview
Environment tree structure
ESQL overview
Message modeling
Related tasks
Designing a message flow
Defining message flow content
Managing ESQL files
Related reference
Compute node
Database node
Filter node
ESQL reference
ROW constructor function
LIST constructor function
ROW and LIST combined
ROW and LIST comparisons
SET statement
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:18:41

ac16840_ This topic's URL is: