Tuesday 16 October 2018

Environment and Local Environment in IIB

Environment


The environment tree is a part of the logical message tree in which you can store information while the message passes through the message flow. The Environment folder is created at the start of a thread. It stays with the thread until the thread dies.
All data that is stored in the Environment tree is stored in memory during the whole message flow and is not freed after it is out of scope. Therefore, if you need space to store local data for node work, then use the LocalEnvironment tree and avoid high memory consumption.

The environment tree differs from the local environment tree in that a single instance of it is maintained throughout the message flow. If you include a Compute node, a Mapping node, or a JavaCompute node in your message flow, you do not have to specify whether you want the environment tree to be included in the output message. The environment tree is included automatically, and the entire contents of the input environment tree are retained in the output environment tree, subject to any modifications that you make in the node. Any changes that you make are available to subsequent nodes in the message flow, and to previous nodes, if the message flows back (for example, to a FlowOrder or TryCatch node).

LocalEnvironment


The local environment tree is a part of the logical message tree in which you can store information while the message flow processes the message.
The local environment tree is made up of the following structure:
Anything in the format of LocalEnvironment.Destination.output_or_request_node_name, for example; LocalEnvironment.Destination.Email, decides what happens when information is going into an output or request node.
Anything in the format of LocalEnvironment.WrittenDestination.output_or_request_node_name, for example; LocalEnvironment.WrittenDestination.FTE, gives you information about the processed output of an output or a request node.
Anything in the format of LocalEnvironment.input_node_name.input, for example; LocalEnvironment.Adapter.Input, contains information that has been stored by an input node.
Use the local environment tree to store variables that can be referred to and updated by message processing nodes that occur later in the message flow. You can also use the local environment tree to define destinations to which a message is sent.

Conclusion


Use the Environment for scratchpad work where you need to maintain the content beyond the scope of the current node, and use the LocalEnvironment for larger scratchpad areas that are only required during the current node, and you need to release the memory after use.
If you want to keep your own values, create it in the environment tree in a subtree called Variables.

Source: IBM® Integration Bus Version Information Center

You may also be interested in these posts: Environment Tree || Populating Destination in the local environment tree