Table of Contents

AmazonMessageReceiveOptions Class

Definition

Namespace
Savvyio.Extensions.SimpleQueueService
Assemblies
Savvyio.Extensions.SimpleQueueService.dll
Source
src/Savvyio.Extensions.SimpleQueueService/AmazonMessageReceiveOptions.cs

Configuration options that is related to receive operations on AWS SQS.

public class AmazonMessageReceiveOptions
Inheritance
object
AmazonMessageReceiveOptions

Examples

AmazonMessageReceiveOptions controls SQS polling behavior — number of messages, visibility timeout, polling timeout, and whether to remove processed messages. Access it through AmazonMessageOptions.ReceiveContext.

using System;
using Amazon;
using Amazon.Runtime;
using Savvyio.Extensions.SimpleQueueService;

namespace ExampleApp;

public class AmazonReceiveSetup
{
    public static AmazonMessageOptions CreateOptions()
    {
        var options = new AmazonMessageOptions
        {
            Credentials = new AnonymousAWSCredentials(),
            Endpoint = RegionEndpoint.EUWest1,
            SourceQueue = new Uri("https://sqs.eu-west-1.amazonaws.com/123456789012/account-commands")
        };
        AmazonMessageReceiveOptions receiveOptions = options.ReceiveContext;
        receiveOptions.NumberOfMessagesToTakePerRequest = 5;
        receiveOptions.VisibilityTimeout = TimeSpan.FromSeconds(30);
        receiveOptions.PollingTimeout = TimeSpan.FromSeconds(20);
        receiveOptions.RemoveProcessedMessages = true;
        return options;
    }
}

Constructors

Name Description
AmazonMessageReceiveOptions()

Initializes a new instance of the AmazonMessageReceiveOptions class.

Properties

Name Description
AssumeMessageProcessed

Gets or sets a value indicating whether each message should be automatically assumed processed. Default is true.

NumberOfMessagesToTakePerRequest

Gets or sets the number of messages to return per request. Default is 10.

PollingTimeout

Gets or sets the polling timeout per request. Default is 20 seconds.

RemoveProcessedMessages

Gets or sets a value indicating whether processed messages should be removed after processing. Default is true.

UseApproximateNumberOfMessages

Gets or sets a value indicating whether to retrieve the approximate number of messages for the queue in question. Default is false.

VisibilityTimeout

Gets or sets the visibility timeout per request. Default is 30 seconds.