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
marshallerIMarshallerThe marshaller used for serializing and deserializing messages.
optionsNatsMessageOptionsThe configuration options for the NATS message.
Exceptions
- ArgumentNullException
marshallercannot be null - or -optionscannot be null.- ArgumentException
optionsare 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()