Common Store and Message Store¶
i-Con keeps state in two places. Use the Common Store for values shared across an interface, and the Message Store for values that belong to one message.
| Common Store | Message Store | |
|---|---|---|
| Scope | Global to the interface, available to every component | Attached to one message as it moves through the flow |
| Typical contents | Endpoints, connection settings, encrypted credentials, tokens, counters | Correlation IDs, request metadata, values captured at one step and used later |
| Lifetime | The life of the running interface. Initial values are set before any thread starts. Values written while running are lost when the interface or service restarts. | The current message as it passes from component to component. Not kept after a restart. |
| Also called | Global Store (in the Store Editor) | |
| In macros | {VariableName} |
{VariableName}, for example {FullName} |
Set up the Common Store¶
- In the Solution panel, select the project.
- In the Properties panel, open the
CommonStoreproperty (select …). - In the String Collection Editor, enter one
key=valueper line. The value can be a constant or a macro.
Use the values anywhere a component accepts a macro, for example {datasource}. Keep anything that changes between your workstation and the server, such as paths and connection details, in the Common Store so you change it in one place.
Store values from a component¶
Every component has a Stores property. Open it to use the Store Editor:
- Choose Global Store (the Common Store) or Message Store.
- Choose whether to run the action on each Incoming Message or Outgoing Message.
- Add Name and Value pairs. The value is usually a macro, for example
CustomerId = {Data(1)}. - Optionally clear the Message Store on every incoming or outgoing message.
Store values aren't saved
The project's CommonStore property sets starting values only. Anything components write to either store is held in memory and lost when the interface restarts. Keep values you need afterwards in a database or file.
Common Store entries can refer to each other, for example Name={Data(1)|Upcase} then Initial={Name[2,3]}.
Values that components set for you¶
Some components add values to the stores automatically. For example, the file reader sets:
| Key | Value |
|---|---|
FileName, FullName, FileExtension |
File name without extension, full name, and extension |
FileDate, DayAge, FileSize |
Creation date, age in days, and size in bytes |
Others include FtpFileName (FTP), @LoopKey and @LoopValue (CrossBar), and the error keys described in Links and execution flow. SQL components with UpdateStore set put result columns in the Common Store by name.