Table of Contents

Struct NatsJSMsg<T>

Namespace
NATS.Client.JetStream
Assembly
NATS.Client.JetStream.dll

NATS JetStream message with NatsMsg<T> and control messages.

public readonly struct NatsJSMsg<T> : INatsJSMsg<T>

Type Parameters

T

User message type

Implements
Inherited Members

Constructors

NatsJSMsg(NatsMsg<T>, NatsJSContext)

Properties

Connection

The connection messages was delivered on.

Data

Deserialized user data.

Error

Any errors (generally serialization errors) encountered while processing the message.

Headers

Headers of the user message if set.

Metadata

Additional metadata about the message.

ReplyTo

The reply subject that subscribers can use to send a response back to the publisher/requester.

Size

Message size in bytes.

Subject

Subject of the user message.

Methods

AckAsync(AckOpts?, CancellationToken)

Acknowledges the message was completely handled.

AckProgressAsync(AckOpts?, CancellationToken)

Indicates that work is ongoing and the wait period should be extended.

AckTerminateAsync(AckOpts?, CancellationToken)

Instructs the server to stop redelivery of the message without acknowledging it as successfully processed.

EnsureSuccess()

Throws an exception if the message contains any errors (generally serialization errors).

NakAsync(AckOpts?, TimeSpan, CancellationToken)

Signals that the message will not be processed now and processing can move onto the next message.

ReplyAsync(NatsHeaders?, string?, NatsPubOpts?, CancellationToken)

Reply with an empty message.