Interface JmsSenderMapper

  • All Known Implementing Classes:
    SimpleAbstractJmsMessageMapper

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

      • mapApamaToJmsMessage

        JmsSenderMessageHolder mapApamaToJmsMessage​(JmsSenderMapperContext context,
                                                    MappableApamaEvent event)
                                             throws java.lang.Exception
        Converts an Apama event string and (possibly null) unique ids for duplicate elimination to a JmsSenderMessageHolder object containing the message and message sending parameters.

        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 - Should never be null
        event - Should never be null
        Returns:
        A JmsSenderMessageHolder containing the JMS Message, and send arguments such as its destination. If the event cannot be handled by this mapper, return null to allow the event 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
      • 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.