Table of Contents

Method ReceiveInternalAsync

Namespace
NATS.Client.Services
Assembly
NATS.Client.Services.dll

ReceiveInternalAsync(string, string?, ReadOnlySequence<byte>?, ReadOnlySequence<byte>)

Invoked when a MSG or HMSG arrives for the subscription. This method is invoked while reading from the socket. Buffers belong to the socket reader and you should process them as quickly as possible or create a copy before you return from this method.

protected override ValueTask ReceiveInternalAsync(string subject, string? replyTo, ReadOnlySequence<byte>? headersBuffer, ReadOnlySequence<byte> payloadBuffer)

Parameters

subject string

Subject received for this subscription. This might not be the subject you subscribed to especially when using wildcards. For example, if you subscribed to events.* you may receive events.open.

replyTo string

Subject the sender wants you to send messages back to it.

headersBuffer ReadOnlySequence<byte>?

Raw headers bytes. You can use NatsConnectionNatsHeaderParser to decode them.

payloadBuffer ReadOnlySequence<byte>

Raw payload bytes.

Returns

ValueTask