Apama 10.7.2 | Connecting Apama Applications to External Components | Working with IAF Plug-ins | Java Codec Plug-in Development | The codec plug-in development specification for Java | Communication with other layers | Sending downstream messages received from a transport plug-in to the Semantic Mapper
 
Sending downstream messages received from a transport plug-in to the Semantic Mapper
When a transport plug-in configured to work with the event codec receives a messages from its external message source, it will pass it on to the codec plug-in by calling the sendTransportEvent method (as defined above). It is then up to the codec plug-in to decode the message from whatever custom format is agreed between the transport and codec plug-ins into a standard normalized event that can be passed on to the Semantic Mapper.
When the message has been decoded, it should be sent to the Semantic Mapper using its sendNormalisedEvent method. See the SemanticMapper interface in the API Reference for Java (Javadoc) for more information on this method.
For example, the implementation of the event codec's sendTransportEvent could look something like this:
// (Assume there's an instance field: SemanticMapper semanticMapper)
// Decode message
NormalisedEvent normalisedEvent = myDecodeMessage(event);
// Send to Transport layer plug-in
semanticMapper.sendNormalisedEvent(normalisedEvent, timestamps);
If an error occurs in the Semantic Mapper, a SemanticMapperException is thrown. Typically such exceptions do not need to be caught by the codec plug-in, unless the codec plug-in is able to somehow deal with the problem.
A CodecException should be thrown if there is an error decoding the normalized event.