Class AbstractSimpleTransport

    • Constructor Detail

      • AbstractSimpleTransport

        public AbstractSimpleTransport​(org.slf4j.Logger logger,
                                       PluginConstructorParameters.TransportConstructorParameters params)
                                throws java.lang.IllegalArgumentException,
                                       java.lang.Exception
        Constructor. A subclass should provide its own constructor with the same signature as this one. This base class makes the parameters passed into its constructor available as member fields or methods for use by the subclass.
        Parameters:
        logger - a slf4j Logger object which can be used to log to the host log file.
        params - an extensible interface providing access to the configuration for this plug-in and other capabilities.
        Throws:
        java.lang.IllegalArgumentException - should be thrown from a plug-in's constructor if the configuration is invalid.
        java.lang.Exception - can be thrown to indicate an internal error.
        Since:
        9.12.0.1
    • Method Detail

      • sendBatchTowardsTransport

        public void sendBatchTowardsTransport​(java.util.List<Message> messages)
        Deliver a batch of messages and pass them on to the next plug-in synchronously. For each message passed in, calls deliverMessageTowardsTransport or deliverNullPayloadTowardsTransport (if the payload was null). On an exception, call handleException.

        If the transport can deliver multiple events in a batch more efficiently, then it should override this method.

      • deliverMessageTowardsTransport

        public abstract void deliverMessageTowardsTransport​(Message message)
                                                     throws java.lang.Exception
        Deliver an individual non-null message. If this method throws then the exception will be logged and the message dropped.
        Throws:
        java.lang.Exception
      • deliverNullPayloadTowardsTransport

        public void deliverNullPayloadTowardsTransport​(Message message)
                                                throws java.lang.Exception
        Deliver an individual null-payload message. By convention, most plug-ins silently ignore messages with null payloads without delivering them. Thus, the default implementation of this method is a no-op.
        Throws:
        java.lang.Exception
      • handleException

        public void handleException​(java.lang.Exception ex,
                                    Message message,
                                    boolean towardsTransport)
        Handle exception thrown from delivering messages. The default implementation is to only log (thus discarding this message, but not others in the same batch)