Null codec transport-related properties
This codec plug-in supports standard Apama properties that are used to specify the name of the transport that will send upstream measages.
Transport-related properties
transportName - This property specifies the transport that the codec should send upstream events to. The property can be used multiple times. The codec maintains a list of all transport names specified in the IAF configuration file. A
transportName property with an empty value is ignored by the codec.
If no transports are provided in the configuration file then the codec saves the last added EventTransport as the default transport. An upstream event is sent to the default transport if no transport information is provided in the normalized event or in the IAF configuration file.
transportFieldName - This property specifies the name of the normalized event field whose value gives the name of the transport that the codec should send the upstream event to. You can also provide a transport name by specifying a value in the
__transport field. Empty values of these fields are ignored and treated as if not present.
removeTransportField - The value of this property specifies whether the transport related fields should be removed from the upstream event before sending it to transport. The default value is
true. If the property is set then the field specified by the
transportFieldName property and the field named
__transport are removed from the upstream event if they are present. Values '
yes', '
y', '
true', '
t', '
1' ignore cases and are treated as
true for this property; any other value is treated as
false.
Upstream behavior
The plug-in's behavior when an upstream event is received proceeds in this order:
1. The codec gets the name of the field that contains the transport name from the value of transportFieldName property. From the specified field, the codec then gets the transport name and sends the event to that transport. If the transportFieldName property is not specified, if the value of the property is empty, if the field is not present in the event, or if the transport name is empty then then codec tries [2].
For example, the following configuration specifies two transports and the filter codec specifies a transport field named TRANSPORT:
<transports>
<transport name="MARKET_DATA" library="transport-lib">
<property name="Host" value="datahost.com" />
<property name="Port" value="444" />
</transport>
<transport name="ORDER_MANAGEMENT" library="transport-lib">
<property name="Host" value="orderhost.com" />
<property name="Port" value="1234" />
</transport>
</transports>
<codecs>
<codec name="NullCodec" library="NullCodec">
<property name="transportFieldName" value="TRANSPORT"/>
...
</codec>
</codecs>
The IAF can now route any upstream event that defines a TRANSPORT field to one of these two transports. The value of the TRANSPORT field, either MARKET_DATA or ORDER_MANAGEMENT, determines the transport. Note: If the removeTransportField property is set true or not defined, then the TRANSPORT field and __transport will be removed (if present) from the upstream event before sending it to transport.
2. The codec gets the transport name from the _transport field of the normalized event and sends the event to specified transport. If the _transport field is not present or if the transport name specified is empty, the codec then tries [3].
For example, in the above configuration, consider an upstream event that does not have a TRANSPORT field or the value of the field is empty. If this event has a value in the __transport field of either MARKET_DATA or ORDER_MANAGEMENT, then that value determines the transport.
3. The codec loops through all transports specified in the transportName property and sends the event to the transport. If no transport is specified then the codec tries [4]. Note that the codec ignores all transport names that are empty.
If an exception occurs while sending the event to any transport, then the codec logs the exception and continues sending events to the remaining transports. If the codec was able to send the event to at least one transport, then it does not throws an exception; otherwise, it throws the last captured exception.
For example, the following configuration specifies two transports:
<transports>
<transport name="MARKET_DATA" library="transport-lib">
<property name="Host" value="datahost.com" />
<property name="Port" value="444" />
</transport>
<transport name="ORDER_MANAGEMENT" library="transport-lib">
<property name="Host" value="orderhost.com" />
<property name="Port" value="1234" />
</transport>
</transports>
<codecs>
<codec name="NullCodec" library="NullCodec">
<property name="transportName" value="ORDER_MANAGEMENT"/>
...
</codec>
</codecs>
In this example, the codec has not defined the transportFieldName property. The IAF will route any upstream event that does not contain a __transport field or has empty value in that field to the ORDER_MANAGEMENT transport.
4. If a default transport name is present, then the codec sends the event to that transport. The default transport is the last-added transport. If a default transport is also not found then, it throws an exception.