Package io.atleon.aws.sqs
Class SqsSenderOptions
- java.lang.Object
-
- io.atleon.aws.sqs.SqsSenderOptions
-
public final class SqsSenderOptions extends Object
Configures behavior of sendingSqsMessages and creation of underlying SQS Client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSqsSenderOptions.BuilderA mutable builder used to construct new instances ofSqsSenderOptions.
-
Field Summary
Fields Modifier and Type Field Description static DurationDEFAULT_BATCH_DURATIONstatic intDEFAULT_BATCH_PREFETCHstatic intDEFAULT_BATCH_SIZEstatic intDEFAULT_MAX_REQUESTS_IN_FLIGHT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DurationbatchDuration()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.intbatchPrefetch()The number of batches to prefetch for sending.intbatchSize()When sending multiple messages to SQS, this configures the batching size.software.amazon.awssdk.services.sqs.SqsAsyncClientcreateClient()Builds a newSqsAsyncClient.static SqsSenderOptionsdefaultOptions(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)Creates a new instance with the provided Client Supplier and default options.intmaxRequestsInFlight()The maximum amount of concurrent SQS Send Requests that are allowed to be in flight per sent Publisher.static SqsSenderOptions.BuildernewBuilder(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)Creates a new (mutable)SqsSenderOptions.Builderwith the provided Client Supplier and initialized with default options.
-
-
-
Field Detail
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_DURATION
public static final Duration DEFAULT_BATCH_DURATION
-
DEFAULT_BATCH_PREFETCH
public static final int DEFAULT_BATCH_PREFETCH
- See Also:
- Constant Field Values
-
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 anSqsAsyncClientinvoked per subscription- Returns:
- A new
SqsSenderOptionsinstance
-
newBuilder
public static SqsSenderOptions.Builder newBuilder(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)
Creates a new (mutable)SqsSenderOptions.Builderwith the provided Client Supplier and initialized with default options.- Parameters:
clientSupplier- The Supplier of anSqsAsyncClientinvoked per subscription- Returns:
- A new (mutable)
SqsSenderOptions.Builderinstance
-
createClient
public software.amazon.awssdk.services.sqs.SqsAsyncClient createClient()
Builds a newSqsAsyncClient.
-
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 thatbatchDuration()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.
-
-