Supported payloads
The Universal Messaging transport supports different types of payload:
Binary payloads. Binary payloads are mapped to the binary payload of a
Universal Messaging message.
Map payloads. Map payloads are mapped to the
nEventProperties of a
Universal Messaging message.
A binary payload in a received message is mapped to a binary payload in Apama. If a received message does not have a binary payload, then the nEventProperties are mapped to a map payload instead.
If the binary payload of incoming messages is being mapped, then the contents of nEventProperties is mapped to metadata values in string form with the prefix um.properties. You can also map all of the nEventProperties to an EPL dictionary with a Mapper codec rule that moves metadata.um.properties in its entirety.
When a message is sent to Universal Messaging which has a map payload, this is mapped to nEventProperties with no binary payload. If the message has a binary payload, this is mapped to the binary payload. In this case, the transport looks for metadata entries of the form um.properties.Key=Value and sets those to Key: Value in the nEventProperties of the message. You can use the Mapper codec to set those values in the message metadata.
If you are sending and receiving using the
eventMap host plug-in (see also
Translating EPL events using the apama.eventMap host plug-in), you probably want to make use of the Mapper and Classifier codecs (see
Codec Connectivity Plug-ins). Typically, the Apama event format does not match exactly to the format you want in the
nEventProperties, and the Mapper codec allows you to fix that.
When setting nEventProperties either from the map payload or via um.properties metadata values, the following EPL types are unsupported and sending events to Universal Messaging will therefore fail:
dictionary<> types with keys which are not Apama primitives (that is, anything except
integer,
boolean,
decimal,
float,
string). For example,
dictionary<Sequence<some type>, String> is not supported, but
dictionary<decimal, <sometype> > is supported.
Apama
decimal type and
dictionary<> keys are stringified when sending the events. That also means that sequence
<decimal> is sent as a sequence of strings.
Sequences within sequences . For example,
sequence<sequence<any type>>. Note that
sequence <Apama Event> or
sequence <dictionary<some primitive, any type> > are supported.
The binary payload may represent a string. If this is a case, then the binary payload must be converted to a string payload before further processing can happen as a string. To do this, use the String codec. This converts binary payloads to string payloads for hostward messages and string payloads to binary payloads for transportward messages. The String codec should be the last codec in the chain. See
The String codec connectivity plug-in for detailed information.
You can also use other codecs such as the JSON codec (see
Codec Connectivity Plug-ins for more information). For example:
dynamicChains:
umJsonChain:
- apama.eventMap:
suppressLoopback: true
description: "@{um.rnames}"
remoteAddress: "@{um.rnames}"
- jsonCodec
- stringCodec
- umTransport:
channelPattern: ".*"