When you work with processes in Neuron ESB, you quite often need to store some kind of state. There are several ways to do this and in particular it is important to know the difference between context.Properties and context.State.

1. Use Push / Pop
The most simple way is to use the Push with the message you need to store and retrieve it later using Pop.



2. Using context.Properties
This gives you more control and the ability to store more than one message (or other part of information).

// Only store the xml content and retrieve (should use less memory)
context.Properties[“org_request_XML”] = context.Data.Text;
context.Data = context.Properties[“org_request_XML”].ToString();

context.Properties only live as long as the Process is executing and are specific to that process.


3. Using context.State
Context.state is very similar to context.Properties, but live as long as the Neuron ESB service is running and can be accessed from any process.

We have used it to cache some configurations-settings which are placed in an external XML-structure to avoid performing the costly XML-lookup each time. But in general you should probably try to avoid using context.State. It should be considered as a kind of Neuron cache.[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]