Class AloRabbitMQSender<T>

  • Type Parameters:
    T - outbound message body type (to be serialized)
    All Implemented Interfaces:
    Closeable, AutoCloseable

    public class AloRabbitMQSender<T>
    extends Object
    implements Closeable
    A reactive RabbitMQ sender with at-least-once semantics for producing messages to exchanges in a RabbitMQ cluster

    At most one instance of a Sender is kept and can be closed upon invoking close(). However, if after closing, more sent Publishers are subscribed to, a new Sender instance will be created and cached.

    • Method Detail

      • sendBodies

        public Flux<RabbitMQSenderResult<T>> sendBodies​(org.reactivestreams.Publisher<T> bodies,
                                                        RabbitMQMessageCreator<T> messageCreator)
        Sends a sequence of message bodies to be populated in RabbitMQMessages. The destination exchange and routing key (if necessary) must be populated by the provided RabbitMQMessageCreator.

        The output of each sent message body is a RabbitMQSenderResult containing the sent value.

        Parameters:
        bodies - A Publisher of RabbitMQ message bodies
        messageCreator - A factory that creates RabbitMQMessages from message bodies
        Returns:
        a Publisher of the results of each sent message
      • sendAloBodies

        public io.atleon.core.AloFlux<RabbitMQSenderResult<T>> sendAloBodies​(org.reactivestreams.Publisher<io.atleon.core.Alo<T>> aloBodies,
                                                                             RabbitMQMessageCreator<T> messageCreator)
        Sends a sequence of Alo items referencing message bodies to be populated in RabbitMQMessages. The destination exchange and routing key (if necessary) must be populated by the provided RabbitMQMessageCreator

        The output of each sent message body is a RabbitMQSenderResult containing the sent value. Each emitted item is an Alo item referencing a RabbitMQSenderResult and must be acknowledged or nacknowledged such that its processing can be marked complete at the origin of the message.

        Parameters:
        aloBodies - A Publisher of Alo items referencing RabbitMQ message bodies
        messageCreator - A factory that creates RabbitMQMessages from message bodies
        Returns:
        a Publisher of Alo items referencing the result of each sent message
      • sendAloMessages

        public io.atleon.core.AloFlux<RabbitMQSenderResult<RabbitMQMessage<T>>> sendAloMessages​(org.reactivestreams.Publisher<io.atleon.core.Alo<RabbitMQMessage<T>>> aloMessages)
        Sends a sequence of Alo items referencing RabbitMQMessages

        The output of each sent message is a RabbitMQSenderResult containing the sent message. Each emitted item is an Alo item referencing a RabbitMQSenderResult and must be acknowledged or nacknowledged such that its processing can be marked complete at the origin of the message.

        Parameters:
        aloMessages - A Publisher of Alo items referencing messages to send
        Returns:
        A Publisher of Alo items referencing the result of each sent message
      • close

        public void close​(Object reason)
        Closes this sender and logs the provided reason.
        Parameters:
        reason - The reason this sender is being closed