Table of Contents

Class NatsMessage

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

Provides a base class for NATS message operations, supporting asynchronous disposal and message serialization.

public abstract class NatsMessage : AsyncDisposable, IDisposable, IAsyncDisposable, IHealthCheckProvider<INatsConnection>
Inheritance
NatsMessage
Implements
IHealthCheckProvider<INatsConnection>
Derived
Inherited Members

Constructors

NatsMessage(IMarshaller, NatsMessageOptions)

Initializes a new instance of the NatsMessage class with the specified marshaller and options.

protected NatsMessage(IMarshaller marshaller, NatsMessageOptions options)

Parameters

marshaller IMarshaller

The marshaller used for serializing and deserializing messages.

options NatsMessageOptions

The configuration options for the NATS message.

Exceptions

ArgumentNullException

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

ArgumentException

options are not in a valid state.

Properties

Marshaller

Gets the marshaller provided by the constructor for serializing and deserializing messages.

protected IMarshaller Marshaller { get; }

Property Value

IMarshaller

The marshaller used for message serialization and deserialization.

NatsClient

Gets the NATS client provided by the constructor for communication with the NATS server.

protected NatsClient NatsClient { get; }

Property Value

NatsClient

Methods

GetHealthCheckTarget()

Gets the NATS.Client.Core.INatsConnection instance used for probing the health status of the NATS server.

public INatsConnection GetHealthCheckTarget()

Returns

INatsConnection

NATS.Client.Core.INatsConnection instance representing the active connection to the NATS server.

OnDisposeManagedResourcesAsync()

Releases the managed resources used by the NatsMessage asynchronously.

protected override ValueTask OnDisposeManagedResourcesAsync()

Returns

ValueTask

A ValueTask that represents the asynchronous dispose operation.