Class SqsSender

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class SqsSender
    extends Object
    implements Closeable
    A low-level sender of SqsMessages. Sent Messages contain the raw String body payload and may reference correlated metadata that is propagated downstream with the Result of sending any given Message.

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

    • Method Detail

      • create

        public static SqsSender create​(SqsSenderOptions options)
        Creates a reactive SQS sender with the specified configuration options.
      • send

        public <C> Mono<SqsSenderResult<C>> send​(SqsSenderMessage<C> message,
                                                 String queueUrl)
        Sends a single SqsSenderMessage to the provided queue URL
        Type Parameters:
        C - The type of correlated metadata associated with the sent message
        Parameters:
        message - A message to send
        queueUrl - The URL of the queue to which the message will be sent
        Returns:
        A Publisher of the result of sending the message
      • send

        public <C> Flux<SqsSenderResult<C>> send​(org.reactivestreams.Publisher<SqsSenderMessage<C>> messages,
                                                 String queueUrl)
        Sends a sequence of SqsSenderMessages to the provided SQS queue URL

        When maxRequestsInFlight is <= 1, results will be published in the same order that their corresponding messages are sent. If maxRequestsInFlight is > 1, it is possible that results may be emitted out of order as concurrent requests may complete with differing latencies.

        Type Parameters:
        C - The type of correlated metadata associated with the sent messages
        Parameters:
        messages - A Publisher of SqsSenderMessages to send
        queueUrl - The URL of the queue to which the messages will be sent
        Returns:
        A Publisher of the results of sending each message