Class SqsReceiverOptions


  • public final class SqsReceiverOptions
    extends Object
    Configures behavior of receiving SqsMessages and management of underlying SQS Client.
    • 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 an SqsAsyncClient invoked per subscription
        Returns:
        A new SqsReceiverOptions instance
      • createClient

        public software.amazon.awssdk.services.sqs.SqsAsyncClient createClient()
        Builds a new SqsAsyncClient.
      • 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 on ReceivedSqsMessages.
      • messageSystemAttributesToRequest

        public Set<String> messageSystemAttributesToRequest()
        The Message System Attributes to request from SQS, which, when available, will be populated on ReceivedSqsMessages. The available set of Attributes are documented in MessageSystemAttributeName.
      • 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 that deleteInterval() 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.