Table of Contents

Property RequestReplyMode

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

RequestReplyMode

Determines the mechanism for handling request-reply interactions in NATS.

public NatsRequestReplyMode RequestReplyMode { get; init; }

Property Value

NatsRequestReplyMode

Remarks

There are two available modes:

1. SharedInbox - Uses a shared subscription inbox for handling replies to request messages, using the muxer.

2. Direct - While using the same inbox prefix, each reply is handled before being processed by the muxer. This mode is more resource-efficient.

The RequestReplyMode setting determines which mode is used during message exchanges initiated by RequestAsync<TRequest, TReply>(string, TRequest?, NatsHeaders?, INatsSerialize<TRequest>?, INatsDeserialize<TReply>?, NatsPubOpts?, NatsSubOpts?, CancellationToken) or other related methods. Defaults to Direct. RequestManyAsync<TRequest, TReply>(string, TRequest?, NatsHeaders?, INatsSerialize<TRequest>?, INatsDeserialize<TReply>?, NatsPubOpts?, NatsSubOpts?, CancellationToken) always uses the shared inbox path regardless of this setting.

No-responders handling depends on whether this is set explicitly. Left at its default, request-reply throws NatsNoRespondersException on a 503 no-responders sentinel. Setting it explicitly to Direct instead returns the sentinel as a message with HasNoResponders set, preserving the behavior of Direct mode before 3.x. Use the per-call ThrowIfNoResponders to override either way.