Package io.atleon.aws.sqs
Class SqsReceiverOptions
- java.lang.Object
-
- io.atleon.aws.sqs.SqsReceiverOptions
-
public final class SqsReceiverOptions extends Object
Configures behavior of receivingSqsMessages and management of underlying SQS Client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSqsReceiverOptions.BuilderA mutable builder used to construct new instances ofSqsReceiverOptions.
-
Field Summary
Fields Modifier and Type Field Description static DurationDEFAULT_CLOSE_TIMEOUTstatic intDEFAULT_DELETE_BATCH_SIZEstatic DurationDEFAULT_DELETE_INTERVALstatic intDEFAULT_MAX_IN_FLIGHT_PER_SUBSCRIPTIONstatic intDEFAULT_MAX_MESSAGES_PER_RECEPTIONstatic intDEFAULT_VISIBILITY_TIMEOUT_SECONDSstatic intDEFAULT_WAIT_TIME_SECONDS_PER_RECEPTION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DurationcloseTimeout()When a subscription to SQS Messages is terminated, this is the amount of time that will be waited for in-flight Requests to be completed and in-flight Messages to be made visible again.software.amazon.awssdk.services.sqs.SqsAsyncClientcreateClient()Builds a newSqsAsyncClient.static SqsReceiverOptionsdefaultOptions(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)Creates a new instance with the provided Client Supplier and default options.intdeleteBatchSize()When deleting messages from SQS, this configures the batching size.DurationdeleteInterval()When delete batching is enabled, this configures the maximum amount of time that will be waited for a batch to be filled before executing the batch.intmaxInFlightPerSubscription()The maximum number of Messages that haven't been deleted or marked as no longer in flight per subscription.intmaxMessagesPerReception()The maximum number of Messages to request in each SQS Receive Message RequestSet<String>messageAttributesToRequest()The Message Attributes to request from SQS, which, when available, will be populated onReceivedSqsMessages.Set<String>messageSystemAttributesToRequest()The Message System Attributes to request from SQS, which, when available, will be populated onReceivedSqsMessages.static SqsReceiverOptions.BuildernewBuilder(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)Creates a new (mutable)SqsReceiverOptions.Builderwith the provided Client Supplier and initialized with default options.intvisibilityTimeoutSeconds()For each message received from SQS, this is the initial amount of seconds that the message will be invisible to other Receive Requests.intwaitTimeSecondsPerReception()The wait time in seconds for each SQS Receive Request.
-
-
-
Field Detail
-
DEFAULT_MAX_MESSAGES_PER_RECEPTION
public static final int DEFAULT_MAX_MESSAGES_PER_RECEPTION
- See Also:
- Constant Field Values
-
DEFAULT_WAIT_TIME_SECONDS_PER_RECEPTION
public static final int DEFAULT_WAIT_TIME_SECONDS_PER_RECEPTION
- See Also:
- Constant Field Values
-
DEFAULT_VISIBILITY_TIMEOUT_SECONDS
public static final int DEFAULT_VISIBILITY_TIMEOUT_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_IN_FLIGHT_PER_SUBSCRIPTION
public static final int DEFAULT_MAX_IN_FLIGHT_PER_SUBSCRIPTION
- See Also:
- Constant Field Values
-
DEFAULT_DELETE_BATCH_SIZE
public static final int DEFAULT_DELETE_BATCH_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_DELETE_INTERVAL
public static final Duration DEFAULT_DELETE_INTERVAL
-
DEFAULT_CLOSE_TIMEOUT
public static final Duration DEFAULT_CLOSE_TIMEOUT
-
-
Method Detail
-
defaultOptions
public static SqsReceiverOptions defaultOptions(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)
Creates a new instance with the provided Client Supplier and default options. Note that a new Client is created per subscription and closed when that subscription is terminated.- Parameters:
clientSupplier- The Supplier of anSqsAsyncClientinvoked per subscription- Returns:
- A new
SqsReceiverOptionsinstance
-
newBuilder
public static SqsReceiverOptions.Builder newBuilder(Supplier<software.amazon.awssdk.services.sqs.SqsAsyncClient> clientSupplier)
Creates a new (mutable)SqsReceiverOptions.Builderwith the provided Client Supplier and initialized with default options.- Parameters:
clientSupplier- The Supplier of anSqsAsyncClientinvoked per subscription- Returns:
- A new (mutable)
SqsReceiverOptions.Builderinstance
-
createClient
public software.amazon.awssdk.services.sqs.SqsAsyncClient createClient()
Builds a newSqsAsyncClient.
-
maxMessagesPerReception
public int maxMessagesPerReception()
The maximum number of Messages to request in each SQS Receive Message Request
-
messageAttributesToRequest
public Set<String> messageAttributesToRequest()
The Message Attributes to request from SQS, which, when available, will be populated onReceivedSqsMessages.
-
messageSystemAttributesToRequest
public Set<String> messageSystemAttributesToRequest()
The Message System Attributes to request from SQS, which, when available, will be populated onReceivedSqsMessages. The available set of Attributes are documented inMessageSystemAttributeName.
-
waitTimeSecondsPerReception
public int waitTimeSecondsPerReception()
The wait time in seconds for each SQS Receive Request. Any positive value activates "long polling".
-
visibilityTimeoutSeconds
public int visibilityTimeoutSeconds()
For each message received from SQS, this is the initial amount of seconds that the message will be invisible to other Receive Requests. If any given Message is not deleted nor has its visibility reset to a positive number of seconds before this amount of seconds elapses, then the Message may be received again, and the Message's original receipt handle will be no longer be valid.
-
maxInFlightPerSubscription
public int maxInFlightPerSubscription()
The maximum number of Messages that haven't been deleted or marked as no longer in flight per subscription.
-
deleteBatchSize
public int deleteBatchSize()
When deleting messages from SQS, this configures the batching size. A batch size <= 1 effectively disables batching such that each Message is deleted in its own Request. A batch size > 1 enables batching, and requires thatdeleteInterval()also be set to a positive Duration.
-
deleteInterval
public Duration deleteInterval()
When delete batching is enabled, this configures the maximum amount of time that will be waited for a batch to be filled before executing the batch. Must be positive when batch deleting is enabled.
-
closeTimeout
public Duration closeTimeout()
When a subscription to SQS Messages is terminated, this is the amount of time that will be waited for in-flight Requests to be completed and in-flight Messages to be made visible again.
-
-