Class BatchOverrideConfiguration.Builder

java.lang.Object
software.amazon.awssdk.services.sqs.batchmanager.BatchOverrideConfiguration.Builder
  • Method Details

    • maxBatchSize

      public BatchOverrideConfiguration.Builder maxBatchSize(Integer maxBatchSize)
      Specifies the maximum number of items that the buffered client will include in a single outbound batch request. Outbound requests include SendMessageBatchRequest, ChangeMessageVisibilityBatchRequest, and DeleteMessageBatchRequest. A batch can contain up to a maximum of 10 messages. The default value is 10.
      Parameters:
      maxBatchSize - The maximum number of items to be batched together in a single request.
      Returns:
      This Builder object for method chaining.
    • sendRequestFrequency

      public BatchOverrideConfiguration.Builder sendRequestFrequency(Duration sendRequestFrequency)
      Specifies the frequency at which outbound batches are sent. This defines the maximum duration that an outbound batch is held open for additional outbound requests before being sent. Outbound requests include SendMessageBatchRequest, ChangeMessageVisibilityBatchRequest, and DeleteMessageBatchRequest. If the maxBatchSize is reached before this duration, the batch will be sent immediately. Increasing the sendRequestFrequency gives more time for additional messages to be added to the batch, which can reduce the number of requests and increase throughput. However, a higher frequency may also result in increased average message latency. The default value is 200 milliseconds.
      Parameters:
      sendRequestFrequency - The new value for the frequency at which outbound requests are sent.
      Returns:
      This Builder object for method chaining.
    • receiveMessageVisibilityTimeout

      public BatchOverrideConfiguration.Builder receiveMessageVisibilityTimeout(Duration receiveMessageVisibilityTimeout)
      Defines the custom visibility timeout to use when retrieving messages from SQS. If set to a positive value, this timeout will override the default visibility timeout set on the SQS queue. If no value is set, then by default, the visibility timeout of the queue will be used. Only positive values are supported.
      Parameters:
      receiveMessageVisibilityTimeout - The new visibilityTimeout value.
      Returns:
      This Builder object for method chaining.
    • receiveMessageMinWaitDuration

      public BatchOverrideConfiguration.Builder receiveMessageMinWaitDuration(Duration receiveMessageMinWaitDuration)
      Configures the minimum wait time for incoming receive message requests. The default value is 50 milliseconds. Without a non-zero minimum wait time, threads can easily waste CPU time by busy-waiting against empty local buffers. Avoid setting this to 0 unless you are confident that threads will perform useful work between each call to receive messages. The call may return sooner than the configured `WaitTimeSeconds` if there are messages in the buffer. If no messages are available and the wait time expires, the call will return an empty message list.
      Parameters:
      receiveMessageMinWaitDuration - The new minimum wait time value.
      Returns:
      This Builder object for method chaining.
    • receiveMessageSystemAttributeNames

      public BatchOverrideConfiguration.Builder receiveMessageSystemAttributeNames(List<MessageSystemAttributeName> receiveMessageSystemAttributeNames)
      Defines the list of message system attribute names to request in receive message calls. If no `messageSystemAttributeNames` are set in the individual request, the ones configured here will be used.

      Requests with different `messageSystemAttributeNames` than those configured here will bypass the BatchManager and make a direct call to SQS. Only requests with matching attribute names will be batched and fulfilled from the receive buffers.

      Parameters:
      receiveMessageSystemAttributeNames - The list of message system attribute names to request. If null, an empty list will be used.
      Returns:
      This builder object for method chaining.
    • receiveMessageAttributeNames

      public BatchOverrideConfiguration.Builder receiveMessageAttributeNames(List<String> receiveMessageAttributeNames)
      Defines the list of message attribute names to request in receive message calls. If no `receiveMessageAttributeNames` are set in the individual requests, the ones configured here will be used.

      Requests with different `receiveMessageAttributeNames` than those configured here will bypass the batched and fulfilled from the receive buffers.

      Parameters:
      receiveMessageAttributeNames - The list of message attribute names to request. If null, an empty list will be used.
      Returns:
      This builder object for method chaining.
    • build

      Builds a new BatchOverrideConfiguration object based on the values set in this builder.
      Specified by:
      build in interface Buildable
      Specified by:
      build in interface SdkBuilder<BatchOverrideConfiguration.Builder,BatchOverrideConfiguration>
      Returns:
      A new BatchOverrideConfiguration object.