Class AmazonMessageOptions
- Namespace
- Savvyio.Extensions.SimpleQueueService
- Assembly
- Savvyio.Extensions.SimpleQueueService.dll
Configuration options that is related to AWS SQS and AWS SNS.
public class AmazonMessageOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
AmazonMessageOptions
- Implements
- Derived
Constructors
AmazonMessageOptions()
Initializes a new instance of the AmazonMessageOptions class.
public AmazonMessageOptions()
Remarks
The following table shows the initial property values for an instance of AmazonMessageOptions.
| Property | Initial Value |
|---|---|
| Credentials | null |
| Endpoint | null |
| SourceQueue | null |
| ClientConfigurations | Enumerable.Empty<ClientConfig>().ToArray(); |
Fields
DefaultVisibilityTimeoutInSeconds
The default amount of seconds that a message can be hidden from other consumers in AWS SQS after it has been received.
public const int DefaultVisibilityTimeoutInSeconds = 30
Field Value
MaxNumberOfMessages
The maximum number of messages that AWS SQS supports when sending or retrieving.
public const int MaxNumberOfMessages = 10
Field Value
MaxPollingWaitTimeInSeconds
The maximum amount of seconds that a call waits for a message to arrive in AWS SQS.
public const int MaxPollingWaitTimeInSeconds = 20
Field Value
MaxVisibilityTimeoutInSeconds
The maximum amount of seconds that a message can be hidden from other consumers in AWS SQS after it has been received.
public const int MaxVisibilityTimeoutInSeconds = 43200
Field Value
Properties
ClientConfigurations
Gets the client configuration for AWS SQS/SNS provided by ConfigureClient(Action<ClientConfig>).
public ClientConfig[] ClientConfigurations { get; }
Property Value
- ClientConfig[]
The configuration of the AWS SQS/SNS.
Remarks
When this property is set, it will take precedence over the Endpoint property. Useful for testing with a local SQS/SNS instance such as LocalStack or require full configuration flexibility.
Credentials
Gets or sets the credentials required to connect to AWS SQS/SNS.
public AWSCredentials Credentials { get; set; }
Property Value
- AWSCredentials
The credentials required to connect to AWS SQS/SNS.
Endpoint
Gets or sets the endpoint required to connect to AWS SQS/SNS.
public RegionEndpoint Endpoint { get; set; }
Property Value
- RegionEndpoint
The endpoint required to connect to AWS SQS/SNS.
ReceiveContext
Gets the options related to receive operations on AWS SQS.
public AmazonMessageReceiveOptions ReceiveContext { get; }
Property Value
- AmazonMessageReceiveOptions
The options related to receive operations on AWS SQS.
SourceQueue
Gets or sets the URI that represents an AWS SQS/SNS endpoint.
public Uri SourceQueue { get; set; }
Property Value
- Uri
The URI that represents an AWS SQS/SNS endpoint.
Methods
ConfigureClient(Action<ClientConfig>)
Provides a flexible way to configure client configurations for both AWS SQS/SNS in a single call.
public AmazonMessageOptions ConfigureClient(Action<ClientConfig> setup)
Parameters
setupAction<ClientConfig>The setup.
Returns
Remarks
When this method is invoked, it will set the ClientConfigurations property that take precedence over the Endpoint property. Useful for testing with a local SQS/SNS instance such as LocalStack or require full configuration flexibility.
Exceptions
- ArgumentNullException
setupcannot be null.
ValidateOptions()
Determines whether the public read-write properties of this instance are in a valid state.
public void ValidateOptions()
Remarks
This method is expected to throw exceptions when one or more conditions fails to be in a valid state.
Exceptions
- InvalidOperationException
Credentials cannot be null - or - Endpoint cannot be null - or - SourceQueue cannot be null - or - ReceiveContext cannot be null -or- ClientConfigurations is initialized but does not have a length of 2 or the expected elements of type AmazonSQSConfig or AmazonSimpleNotificationServiceConfig.