Message properties are metadata associated with a message as it flows through Rhapsody. They may contain values extracted from the message content itself, or may contain other arbitrary data that has been associated with them. In some cases, these values may be needed within a mapping so that the property values can be included in the output message.
Message properties of the input message can be accessed in the mapping code using global variables. Before running a mapping, the Mapper filter compares the list of message properties on the message to be mapped with the list of global variables defined in the mapping code. If there is a global variable with the same name as a message property, the global variable is set to the current value of the message property. Similarly, Rhapsody variables defined in the Variables Manager can also be accessed in the mapping code using global variables. The priority order for substitution is as follows:
- Message property.
- Rhapsody variable.
- Global variable.
Ensure your global variables are named in a unique manner to avoid them being accidentally overridden by message properties or Rhapsody variables that have the same name.
After a mapping has completed, the Mapper filter retrieves the final values of all the global variables used in the mapping. These global variables are then copied to message properties of the same name on the output message.
Defining Global Variables
To define global variables in a mapping project, select the Global Variables iconon the Map Designer toolbar. You can then add global variables: