Table of Contents

Class NatsCommandQueue

Namespace
Savvyio.Extensions.NATS.Commands
Assembly
Savvyio.Extensions.NATS.dll

Provides a NATS JetStream implementation of the IPointToPointChannel<TRequest> for command messages.

public class NatsCommandQueue : NatsMessage, IDisposable, IAsyncDisposable, IHealthCheckProvider<INatsConnection>, IPointToPointChannel<ICommand>, ISender<ICommand>, IReceiver<ICommand>
Inheritance
NatsCommandQueue
Implements
IHealthCheckProvider<INatsConnection>
Derived
Inherited Members

Constructors

NatsCommandQueue(IMarshaller, NatsCommandQueueOptions)

Initializes a new instance of the NatsCommandQueue class.

public NatsCommandQueue(IMarshaller marshaller, NatsCommandQueueOptions options)

Parameters

marshaller IMarshaller

The marshaller used for serializing and deserializing messages.

options NatsCommandQueueOptions

The NatsCommandQueueOptions used to configure this instance.

Exceptions

ArgumentNullException

marshaller cannot be null - or - options cannot be null.

ArgumentException

options are not in a valid state.

Methods

ReceiveAsync(Action<AsyncOptions>)

Receives command messages asynchronously from the configured NATS JetStream consumer.

public IAsyncEnumerable<IMessage<ICommand>> ReceiveAsync(Action<AsyncOptions> setup = null)

Parameters

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

IAsyncEnumerable<IMessage<ICommand>>

An IAsyncEnumerable<T> that yields IMessage<T> instances as they are received.

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

Sends the specified command messages asynchronously to the configured NATS JetStream subject.

public Task SendAsync(IEnumerable<IMessage<ICommand>> messages, Action<AsyncOptions> setup = null)

Parameters

messages IEnumerable<IMessage<ICommand>>

The messages to send.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

See Also