Apama 10.3.1 | Apama Documentation | Connecting Apama Applications to External Components | Working with Connectivity Plug-ins | Developing Connectivity Plug-ins | Metadata values
 
Metadata values
Every message has a metadata member, which for Java is a Map object containing String keys and Object values. For C++, it is a map_t which by convention only contains const char * keys, but any type as values.
The metadata holds information about the event:
Value
Description
sag.type
The name of the event type. This is required when sending events into the apama.eventMap plug-in, unless the defaultEventType configuration property is set. For the apama.eventString plug-in, the event type name comes from the string form of the event itself.
sag.channel
The name of the channel from which the event originated or to which it is to be delivered. This is optional for hostwards messages.
Note: If the transport uses the same channel through its lifetime, it is recommended that you set the defaultChannel property in the configuration file, rather than setting the sag.channel for every message. See also Host plug-ins and configuration.
sag.messageId
The message identifier. This is used for reliable receiving (that is, in reliable messages going towards the host). The message identifier should be unique within the scope of the chain and deployment and during the lifetime of the application. Typically it will be generated by the message bus to which the connectivity plug-in transport is connected. See also Using reliable transports.
Caution: If you are using a codec to make the message identifier visible as an event field in EPL, it is important to copy the value from sag.messageId. Moving the value (and thus removing it from sag.messageId) will disrupt reliable receiving.
In Java, these values are available as constants on the Message class:
*Message.HOST_MESSAGE_TYPE
*Message.CHANNEL
*Message.MESSAGE_ID
In C++, these are the following methods:
*HOST_MESSAGE_TYPE()
*CHANNEL()
*MESSAGE_ID()
Plug-in components can use the metadata to pass other auxiliary data about a message between chain components. These could be headers from an HTTP connection, authentication tokens, or signalling for transaction boundaries. It is recommended that all metadata keys are namespaced. The sag namespace is reserved for Software AG use. Host plug-ins currently only use the metadata keys above.
The metadata contents can be manipulated directly by calling methods on the map returned by Message.getMetadataMap(). A Message.getMetadata() is also available in order to manipulate the stringified version of the metadata values. Values can be inserted into the metadata by using Message.putMetadataValue(...).

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.