Interface JmsReceiverMapper

  • All Known Implementing Classes:
    SimpleAbstractJmsMessageMapper

    public interface JmsReceiverMapper
    Message mapper interface for a class that can synchronously convert a received JMS message to an event string (and optional duplication detection ids).
    • Method Detail

      • mapJmsToApamaMessage

        MappableApamaEvent mapJmsToApamaMessage​(JmsReceiverMapperContext context,
                                                javax.jms.Message message)
                                         throws java.lang.Exception,
                                                javax.jms.JMSException
        Converts a JMS message object to an Apama event string (and unique message id for dup elimination, if available).

        Threading: a separate instance of the mapper interface will be created for each thread, so implementations of this method are not required to be thread-safe, and should in fact be careful to avoid synchronizing on data structures shared with other mapper instance to ensure mapping can be performed in parallel. Implementors may use read-only (unsynchronized) shared configuration state, including Apama EventType objects, but caches and other read-write data structures should be stored in instances of this object to ensure optimum performance and scalability.

        Parameters:
        context - Never null.
        message - Never null.
        Returns:
        A MappableApamaEvent. If the message cannot be handled by this mapper, return null to allow the message to be discarded, or mapping to be delegated to another mapper if configured (but never return null in the event of an error - failure to handle a message this mapper is responsible for should always result in throwing an exception).
        Throws:
        java.lang.Exception - If the mapping could not be performed for some reason.
        javax.jms.JMSException
      • destroy

        void destroy()
        Disposes of any background threads, caches or other resources created by this mapper instance.

        Most mappers do not need to do anything in their implementation of this method. Note that this method will always be called after all mapping is complete, however it may not be called on the same thread that mapping happened on.