Table of Contents

Class SQSMessagePollerConfiguration

Namespace
AWS.Messaging.Configuration
Assembly
AWS.Messaging.dll

Internal configuration for polling messages from SQS

public class SQSMessagePollerConfiguration : IMessagePollerConfiguration
Inheritance
SQSMessagePollerConfiguration
Implements

Constructors

SQSMessagePollerConfiguration(string)

Construct an instance of SQSMessagePollerConfiguration

public SQSMessagePollerConfiguration(string queueUrl)

Parameters

queueUrl string

The SQS QueueUrl to poll messages from.

Fields

DEFAULT_MAX_NUMBER_OF_CONCURRENT_MESSAGES

public const int DEFAULT_MAX_NUMBER_OF_CONCURRENT_MESSAGES = 10

Field Value

int

Remarks

The default value is 10 messages.

DEFAULT_VISIBILITY_TIMEOUT_EXTENSION_HEARTBEAT_INTERVAL

public const int DEFAULT_VISIBILITY_TIMEOUT_EXTENSION_HEARTBEAT_INTERVAL = 1

Field Value

int

Remarks

The default value is 1 second.

DEFAULT_VISIBILITY_TIMEOUT_EXTENSION_THRESHOLD_SECONDS

public const int DEFAULT_VISIBILITY_TIMEOUT_EXTENSION_THRESHOLD_SECONDS = 5

Field Value

int

Remarks

The default value is 5 seconds.

DEFAULT_VISIBILITY_TIMEOUT_SECONDS

Default value for VisibilityTimeout

public const int DEFAULT_VISIBILITY_TIMEOUT_SECONDS = 30

Field Value

int

Remarks

The default value is 30 seconds.

DEFAULT_WAIT_TIME_SECONDS

Default value for WaitTimeSeconds

public const int DEFAULT_WAIT_TIME_SECONDS = 20

Field Value

int

Remarks

The default value is 20 seconds.

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

Func<Exception, bool>

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; init; }

Property Value

int

Remarks

The default value is 10 messages.

SubscriberEndpoint

The SQS QueueUrl to poll messages from.

public string SubscriberEndpoint { get; }

Property Value

string

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 the receive-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; init; }

Property Value

int

Remarks

The default value is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours.

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; init; }

Property Value

int

Remarks

The default value is 1 second.

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; init; }

Property Value

int

Remarks

The default value is 5 seconds.

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; init; }

Property Value

int

Remarks

The default value is 20 seconds. The minimum is 0 seconds. The maximum is 20 seconds.