Interface AdaptrisMessageWorker

    • Method Detail

      • registerConnection

        void registerConnection​(AdaptrisConnection connection)

        Sets the AdaptrisConnection this component will use.

        Parameters:
        connection - the AdaptrisConnection to use
      • retrieveConnection

        <T> T retrieveConnection​(java.lang.Class<T> type)
        Return this components underlying connection.
        Parameters:
        type - the type of connection to cast to.
        Returns:
        the connection
      • getEncoder

        AdaptrisMessageEncoder getEncoder()

        Returns the AdaptrisMessageEncoder to use.

        Returns:
        the AdaptrisMessageEncoder to use
      • setEncoder

        void setEncoder​(AdaptrisMessageEncoder encoder)

        Sets the AdaptrisMessageEncoder to use.

        Parameters:
        encoder - the AdaptrisMessageEncoder to use
      • handleConnectionException

        void handleConnectionException()
                                throws CoreException

        Called if a connection exception is encountered. Generally this will be when a polling consumer fails to obtain input, when a producer fails to produce or when some third party thread such as JMS exception listener is invoked.

        Throws:
        CoreException - wrapping underlying Exceptions
      • encode

        byte[] encode​(AdaptrisMessage msg)
               throws CoreException

        Encode the passed message using the configured AdaptrisMessageEncoder. If no AME is configured implementations should return msg.getBytes().

        Parameters:
        msg - the AdaptrisMessage to encode
        Returns:
        the AdaptrisMessage encoded as a byte[]
        Throws:
        CoreException - wrapping any that occur
      • decode

        AdaptrisMessage decode​(byte[] bytes)
                        throws CoreException

        Decodes the passed byte[] using the configured AdaptrisMessageEncoder. If no AME is configured, implementations should just set the byte[] as the payload of a new message.

        Parameters:
        bytes - the byte[] to decode
        Returns:
        an AdaptrisMessage
        Throws:
        CoreException - wrapping any that occur
      • setMessageFactory

        void setMessageFactory​(AdaptrisMessageFactory f)
        Set the message factory used when creating AdaptrisMessage instances.
        Parameters:
        f - the messageFactory to set