Class SqsSenderOptions


  • public final class SqsSenderOptions
    extends Object
    Configures behavior of sending SqsMessages and creation of underlying SQS Client.
    • Field Detail

      • DEFAULT_BATCH_DURATION

        public static final Duration DEFAULT_BATCH_DURATION
      • DEFAULT_MAX_REQUESTS_IN_FLIGHT

        public static final int DEFAULT_MAX_REQUESTS_IN_FLIGHT
        See Also:
        Constant Field Values
    • Method Detail

      • defaultOptions

        public static SqsSenderOptions defaultOptions​(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)
        Creates a new instance with the provided Client Supplier and default options. Each Sender will reference at most one non-closed Client at any given time.
        Parameters:
        clientSupplier - The Supplier of an SqsAsyncClient invoked per subscription
        Returns:
        A new SqsSenderOptions instance
      • newBuilder

        public static SqsSenderOptions.Builder newBuilder​(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)
        Creates a new (mutable) SqsSenderOptions.Builder with the provided Client Supplier and initialized with default options.
        Parameters:
        clientSupplier - The Supplier of an SqsAsyncClient invoked per subscription
        Returns:
        A new (mutable) SqsSenderOptions.Builder instance
      • createClient

        public software.amazon.awssdk.services.sqs.SqsAsyncClient createClient()
        Builds a new SqsAsyncClient.
      • batchSize

        public int batchSize()
        When sending multiple messages to SQS, this configures the batching size. A batch size <= 1 effectively disables batching such that each Message is sent in its own Request. A batch size > 1 enables batching, and requires that batchDuration() also be set to a positive Duration.
      • batchDuration

        public Duration batchDuration()
        When batching is enabled, this configures the maximum amount of time that will be waited for a batch to be filled before sending the batch. Must be positive when batching is enabled.
      • batchPrefetch

        public int batchPrefetch()
        The number of batches to prefetch for sending. Should not typically need to be explicitly configured unless batching is enabled AND the max number of in-flight requests is greater than 1. Note that resulting upstream prefetch will be product of batchSize * batchPrefetch.
      • maxRequestsInFlight

        public int maxRequestsInFlight()
        The maximum amount of concurrent SQS Send Requests that are allowed to be in flight per sent Publisher. If batching is disabled, this is the maximum number of Messages in flight. If batching is enabled, this is the maximum number of batched requests in flight.