Table of Contents

AzureCommandQueue Class

Definition

Provides an Azure Storage Queue implementation of the IPointToPointChannel<TRequest>.

public class AzureCommandQueue : AzureQueue<ICommand>, IPointToPointChannel<ICommand>, ISender<ICommand>, IReceiver<ICommand>, IHealthCheckProvider<QueueServiceClient>
Inheritance
object
AzureCommandQueue
Implements
Derived
Inherited Members

Examples

AzureCommandQueue sends and receives commands through Azure Queue Storage. Configure it with AzureQueueOptions and an IMarshaller instance, then use it as IPointToPointChannel<ICommand>.

using Savvyio.Commands;
using Savvyio.Extensions.QueueStorage;
using Savvyio.Extensions.QueueStorage.Commands;
using Savvyio.Messaging;

namespace ExampleApp;

public class AzureCommandQueueConfig
{
    public static AzureQueueOptions CreateOptions()
    {
        return new AzureQueueOptions
        {
            ConnectionString = "UseDevelopmentStorage=true",
            QueueName = "account-commands"
        };
    }

    public static IPointToPointChannel<ICommand> AsChannel(AzureCommandQueue queue) => queue;
}

Constructors

Name Description
AzureCommandQueue(IMarshaller, AzureQueueOptions)

Initializes a new instance of the AzureCommandQueue class.

Methods

Name Description
GetHealthCheckTarget()

Gets the QueueServiceClient instance used for probing the health status of the Azure Storage Queue service.

ReceiveAsync(Action<AsyncOptions>)

Receives messages from the Azure Storage Queue.

SendAsync(IEnumerable<IMessage<ICommand>>, Action<AsyncOptions>)

Sends the specified messages to the Azure Storage Queue.