Class QueueBufferConfig
java.lang.Object
com.amazonaws.services.sqs.buffered.QueueBufferConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final long
200 millisecondsstatic final long
256 kilobytesstatic final int
static final int
10 batchesstatic final int
5 batchesstatic final int
10 batchesstatic final long
Updated as the service now supports messages of size max 256 KiB.static final int
-1, which means use the visibility timeout of the queue -
Constructor Summary
ConstructorsConstructorDescriptionQueueBufferConfig
(long maxBatchOpenMs, int maxInflightOutboundBatches, int maxInflightReceiveBatches, int maxDoneReceiveBatches, boolean paramLongPoll, long maxBatchSizeBytes, int visibilityTimeout, int longPollTimeout, int maxBatch) copy constructor -
Method Summary
Modifier and TypeMethodDescriptionint
Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made.long
The maximum time (milliseconds) a send batch is held open for additional outbound requests.int
Specifies the maximum number of entries the buffered client will put in a single batch request.long
Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes.int
If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop.
The larger this number, the more messages the queue buffer will pre-fetch and keep in the buffer on the client side, and the faster receive requests will be satisfied.int
The maximum number of concurrent batches for each type of outbound request.int
The maximum number of concurrent receive message batches.int
Custom visibility timeout to use when retrieving messages from SQS.boolean
void
setLongPoll
(boolean longPoll) Specify "true" for receive requests to use long polling.void
setLongPollWaitTimeoutSeconds
(int longPollWaitTimeoutSeconds) Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made.void
setMaxBatchOpenMs
(long maxBatchOpenMs) The maximum time (milliseconds) a send batch is held open for additional outbound requests.void
setMaxBatchSize
(int maxBatchSize) Specifies the maximum number of entries the buffered client will put in a single batch request.void
setMaxBatchSizeBytes
(long maxBatchSizeBytes) Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes.void
setMaxDoneReceiveBatches
(int maxDoneReceiveBatches) If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop.void
setMaxInflightOutboundBatches
(int maxInflightOutboundBatches) The maximum number of concurrent batches for each type of outbound request.void
setMaxInflightReceiveBatches
(int maxInflightReceiveBatches) The maximum number of concurrent receive message batches.void
setVisibilityTimeoutSeconds
(int visibilityTimeoutSeconds) Custom visibility timeout to use when retrieving messages from SQS.toString()
withLongPoll
(boolean longPoll) Specify "true" for receive requests to use long polling.withLongPollWaitTimeoutSeconds
(int longPollWaitTimeoutSeconds) Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made.withMaxBatchOpenMs
(long maxBatchOpenMs) The maximum time (milliseconds) a send batch is held open for additional outbound requests.withMaxBatchSize
(int maxBatchSize) Specifies the maximum number of entries the buffered client will put in a single batch request.withMaxBatchSizeBytes
(long maxBatchSizeBytes) Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes.withMaxDoneReceiveBatches
(int maxDoneReceiveBatches) If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop.withMaxInflightOutboundBatches
(int maxInflightOutboundBatches) The maximum number of concurrent batches for each type of outbound request.withMaxInflightReceiveBatches
(int maxInflightReceiveBatches) The maximum number of concurrent receive message batches.withVisibilityTimeoutSeconds
(int visibilityTimeoutSeconds) Custom visibility timeout to use when retrieving messages from SQS.
-
Field Details
-
MAX_BATCH_SIZE_DEFAULT
public static final int MAX_BATCH_SIZE_DEFAULT- See Also:
-
SERVICE_MAX_BATCH_SIZE_BYTES
public static final long SERVICE_MAX_BATCH_SIZE_BYTESUpdated as the service now supports messages of size max 256 KiB.- See Also:
-
MAX_BATCH_OPEN_MS_DEFAULT
public static final long MAX_BATCH_OPEN_MS_DEFAULT200 milliseconds- See Also:
-
MAX_INFLIGHT_OUTBOUND_BATCHES_DEFAULT
public static final int MAX_INFLIGHT_OUTBOUND_BATCHES_DEFAULT5 batches- See Also:
-
MAX_INFLIGHT_RECEIVE_BATCHES_DEFAULT
public static final int MAX_INFLIGHT_RECEIVE_BATCHES_DEFAULT10 batches- See Also:
-
MAX_DONE_RECEIVE_BATCHES_DEFAULT
public static final int MAX_DONE_RECEIVE_BATCHES_DEFAULT10 batches- See Also:
-
MAX_BATCH_SIZE_BYTES_DEFAULT
public static final long MAX_BATCH_SIZE_BYTES_DEFAULT256 kilobytes- See Also:
-
VISIBILITY_TIMEOUT_SECONDS_DEFAULT
public static final int VISIBILITY_TIMEOUT_SECONDS_DEFAULT-1, which means use the visibility timeout of the queue- See Also:
-
LONGPOLL_WAIT_TIMEOUT_SECONDS_DEFAULT
public static final int LONGPOLL_WAIT_TIMEOUT_SECONDS_DEFAULT- See Also:
-
-
Constructor Details
-
QueueBufferConfig
public QueueBufferConfig(long maxBatchOpenMs, int maxInflightOutboundBatches, int maxInflightReceiveBatches, int maxDoneReceiveBatches, boolean paramLongPoll, long maxBatchSizeBytes, int visibilityTimeout, int longPollTimeout, int maxBatch) -
QueueBufferConfig
public QueueBufferConfig() -
QueueBufferConfig
copy constructor
-
-
Method Details
-
toString
-
getMaxBatchOpenMs
public long getMaxBatchOpenMs()The maximum time (milliseconds) a send batch is held open for additional outbound requests. The longer this timeout, the longer messages wait for other messages to be added to the batch. Increasing this timeout reduces the number of calls made and increases throughput, but also increases average message latency. -
setMaxBatchOpenMs
public void setMaxBatchOpenMs(long maxBatchOpenMs) The maximum time (milliseconds) a send batch is held open for additional outbound requests. The longer this timeout, the longer messages wait for other messages to be added to the batch. Increasing this timeout reduces the number of calls made and increases throughput, but also increases average message latency. -
withMaxBatchOpenMs
The maximum time (milliseconds) a send batch is held open for additional outbound requests. The longer this timeout, the longer messages wait for other messages to be added to the batch. Increasing this timeout reduces the number of calls made and increases throughput, but also increases average message latency. -
isLongPoll
public boolean isLongPoll()- Returns:
- true if the queue buffer will use long polling while retrieving messages from the SQS server, false otherwise.
-
setLongPoll
public void setLongPoll(boolean longPoll) Specify "true" for receive requests to use long polling. -
withLongPoll
Specify "true" for receive requests to use long polling. -
getMaxInflightOutboundBatches
public int getMaxInflightOutboundBatches()The maximum number of concurrent batches for each type of outbound request. The greater the number, the greater the throughput that can be achieved (at the expense of consuming more threads). -
setMaxInflightOutboundBatches
public void setMaxInflightOutboundBatches(int maxInflightOutboundBatches) The maximum number of concurrent batches for each type of outbound request. The greater the number, the greater the throughput that can be achieved (at the expense of consuming more threads). -
withMaxInflightOutboundBatches
The maximum number of concurrent batches for each type of outbound request. The greater the number, the greater the throughput that can be achieved (at the expense of consuming more threads). -
getMaxInflightReceiveBatches
public int getMaxInflightReceiveBatches()The maximum number of concurrent receive message batches. The greater this number, the faster the queue will be pulling messages from the SQS servers (at the expense of consuming more threads). -
setMaxInflightReceiveBatches
public void setMaxInflightReceiveBatches(int maxInflightReceiveBatches) The maximum number of concurrent receive message batches. The greater this number, the faster the queue will be pulling messages from the SQS servers (at the expense of consuming more threads). -
withMaxInflightReceiveBatches
The maximum number of concurrent receive message batches. The greater this number, the faster the queue will be pulling messages from the SQS servers (at the expense of consuming more threads). -
getMaxDoneReceiveBatches
public int getMaxDoneReceiveBatches()If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop.
The larger this number, the more messages the queue buffer will pre-fetch and keep in the buffer on the client side, and the faster receive requests will be satisfied.
The visibility timeout of a pre-fetched message starts at the point of pre-fetch, which means that while the message is in the local buffer it is unavailable for other clients to process, and when this client retrieves it, part of the visibility timeout may have already expired.
The number of messages prefetched will not exceed 10 * maxDoneReceiveBatches, as there can be a maximum of 10 messages per batch. -
setMaxDoneReceiveBatches
public void setMaxDoneReceiveBatches(int maxDoneReceiveBatches) If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop. The larger this number, the more messages the buffer queue will pre-fetch and keep in the buffer on the client side, and the faster receive requests will be satisfied. The visibility timeout of a pre-fetched message starts at the point of pre-fetch, which means that while the message is in the local buffer it is unavailable for other clients to process, and when this client retrieves it, part of the visibility timeout may have already expired. The number of messages prefetched will not exceed maxBatchSize * maxDoneReceiveBatches. -
withMaxDoneReceiveBatches
If more than that number of completed receive batches are waiting in the buffer, the querying for new messages will stop. The larger this number, the more messages the buffer queue will pre-fetch and keep in the buffer on the client side, and the faster receive requests will be satisfied. The visibility timeout of a pre-fetched message starts at the point of pre-fetch, which means that while the message is in the local buffer it is unavailable for other clients to process, and when this client retrieves it, part of the visibility timeout may have already expired. The number of messages prefetched will not exceed maxBatchSize * maxDoneReceiveBatches. -
getMaxBatchSizeBytes
public long getMaxBatchSizeBytes()Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes. This setting is also enforced on the server, and if this client submits a request of a size larger than the server can support, the server will reject the request. -
setMaxBatchSizeBytes
public void setMaxBatchSizeBytes(long maxBatchSizeBytes) Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes. This setting is also enforced on the server, and if this client submits a request of a size larger than the server can support, the server will reject the request.- Throws:
IllegalArgumentException
- if the size being set is greater than the service allowed size for message body.
-
withMaxBatchSizeBytes
Maximum permitted size of a SendMessage or SendMessageBatch message, in bytes. This setting is also enforced on the server, and if this client submits a request of a size larger than the server can support, the server will reject the request.- Throws:
IllegalArgumentException
- if the size being set is greater than the service allowed size for message body.
-
getVisibilityTimeoutSeconds
public int getVisibilityTimeoutSeconds()Custom visibility timeout to use when retrieving messages from SQS. If set to a value greater than zero, this timeout will override the default visibility timeout set on the SQS queue. Set it to -1 to use the default visiblity timeout of the queue. Visibility timeout of 0 seconds is not supported. -
setVisibilityTimeoutSeconds
public void setVisibilityTimeoutSeconds(int visibilityTimeoutSeconds) Custom visibility timeout to use when retrieving messages from SQS. If set to a value greater than zero, this timeout will override the default visibility timeout set on the SQS queue. Set it to -1 to use the default visiblity timeout of the queue. Visibility timeout of 0 seconds is not supported. -
withVisibilityTimeoutSeconds
Custom visibility timeout to use when retrieving messages from SQS. If set to a value greater than zero, this timeout will override the default visibility timeout set on the SQS queue. Set it to -1 to use the default visiblity timeout of the queue. Visibility timeout of 0 seconds is not supported. -
setLongPollWaitTimeoutSeconds
public void setLongPollWaitTimeoutSeconds(int longPollWaitTimeoutSeconds) Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made. This setting has no effect if long polling is disabled. -
getLongPollWaitTimeoutSeconds
public int getLongPollWaitTimeoutSeconds()Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made. This setting has no effect if long polling is disabled. -
withLongPollWaitTimeoutSeconds
Specifies the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the queue is empty when the receive call is first made. This setting has no effect if long polling is disabled. -
getMaxBatchSize
public int getMaxBatchSize()Specifies the maximum number of entries the buffered client will put in a single batch request. -
setMaxBatchSize
public void setMaxBatchSize(int maxBatchSize) Specifies the maximum number of entries the buffered client will put in a single batch request. -
withMaxBatchSize
Specifies the maximum number of entries the buffered client will put in a single batch request.
-