Developing Apama Applications > Developing Adapters > Java Codec Plug-in Development > The Java Codec Plug-in Development Specification > 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 normalised 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:
/**
* Called by the event codec to send a decoded event to the Semantic Mapper.
*
* @param event A normalised event to be sent to the semantic mapper
* @param timestamps A TimestampSet representing the timestamps attached to
* the event.
*
* @throws SemanticMapperException Thrown by the Semantic Mapper if there
* is a problem mapping the event
*/
public void sendNormalisedEvent(NormalisedEvent event,
      TimestampSet timestamps)
    throws SemanticMapperException;
For example, the implementation of the event codec’s sendTranasportEvent could look something like this:
// (Assume there’s an instance field: SemanticMapper semanticMapper)
// Decode message
NormalisedEvent normalisedEvent = myDecodeMessage(event);
// Send to Transport layer plugin
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 normalised event.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.