Class SQSMessagePollerOptions
- Namespace
- AWS.Messaging.Configuration
- Assembly
- AWS.Messaging.dll
Configuration for polling messages from SQS
public class SQSMessagePollerOptions
- Inheritance
-
SQSMessagePollerOptions
Properties
IsExceptionFatal
Determines if a given exception should be treated as fatal and rethrown to stop the SQS poller.
public Func<Exception, bool> IsExceptionFatal { get; set; }
Property Value
Remarks
This method only applies to the SQS poller, and not to publishing messages nor handling messages in Lambda.
MaxNumberOfConcurrentMessages
The maximum number of messages from this queue to process concurrently.
public int MaxNumberOfConcurrentMessages { get; set; }
Property Value
Remarks
VisibilityTimeout
Gets and sets the property VisibilityTimeout.
The duration (in seconds) that the received messages are hidden from subsequent retrieve
requests after being retrieved by a ReceiveMessage
request. If not specified,
the default visibility timeout for the queue is used, which is 30 seconds.
Understanding VisibilityTimeout
:
-
When a message is received from a queue, it becomes temporarily invisible to other consumers for the duration of the visibility timeout. This prevents multiple consumers from processing the same message simultaneously. If the message is not deleted or its visibility timeout is not extended before the timeout expires, it becomes visible again and can be retrieved by other consumers.
-
Setting an appropriate visibility timeout is crucial. If it's too short, the message might become visible again before processing is complete, leading to duplicate processing. If it's too long, it delays the reprocessing of messages if the initial processing fails.
-
You can adjust the visibility timeout using the
--visibility-timeout
parameter in thereceive-message
command to match the processing time required by your application. -
A message that isn't deleted or a message whose visibility isn't extended before the visibility timeout expires counts as a failed receive. Depending on the configuration of the queue, the message might be sent to the dead-letter queue.
For more information, see Visibility Timeout in the Amazon SQS Developer Guide.
public int VisibilityTimeout { get; set; }
Property Value
Remarks
VisibilityTimeoutExtensionHeartbeatInterval
How frequently the framework will check in flight messages and extend the visibility timeout of messages that will expire within the VisibilityTimeoutExtensionThreshold.
public int VisibilityTimeoutExtensionHeartbeatInterval { get; set; }
Property Value
Remarks
VisibilityTimeoutExtensionThreshold
When an in flight message is within this many seconds of becoming visible again, the framework will extend its visibility timeout automatically. The new visibility timeout will be set to VisibilityTimeout seconds relative to now.
public int VisibilityTimeoutExtensionThreshold { get; set; }
Property Value
Remarks
WaitTimeSeconds
Gets and sets the property WaitTimeSeconds.
The duration (in seconds) for which the call waits for a message to arrive in the
queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds
.
If no messages are available and the wait time expires, the call does not return a
message list. If you are using the Java SDK, it returns a ReceiveMessageResponse
object, which has a empty list instead of a Null object.
To avoid HTTP errors, ensure that the HTTP response timeout for ReceiveMessage
requests is longer than the WaitTimeSeconds
parameter. For example, with the
Java SDK, you can set HTTP transport settings using the
NettyNioAsyncHttpClient for asynchronous clients, or the
ApacheHttpClient for synchronous clients.
public int WaitTimeSeconds { get; set; }