Method RequestManyAsync
RequestManyAsync<TRequest, TReply>(string, TRequest?, NatsHeaders?, INatsSerialize<TRequest>?, INatsDeserialize<TReply>?, NatsPubOpts?, NatsSubOpts?, CancellationToken)
Request and receive zero or more replies from a responder.
IAsyncEnumerable<NatsMsg<TReply>> RequestManyAsync<TRequest, TReply>(string subject, TRequest? data, NatsHeaders? headers = null, INatsSerialize<TRequest>? requestSerializer = null, INatsDeserialize<TReply>? replySerializer = null, NatsPubOpts? requestOpts = null, NatsSubOpts? replyOpts = null, CancellationToken cancellationToken = default)
Parameters
subject
stringSubject of the responder
data
TRequestData to send to responder
headers
NatsHeadersOptional message headers
requestSerializer
INatsSerialize<TRequest>Serializer to use for the request message type.
replySerializer
INatsDeserialize<TReply>Serializer to use for the reply message type.
requestOpts
NatsPubOptsRequest publish options
replyOpts
NatsSubOptsReply handler subscription options
cancellationToken
CancellationTokenCancel this request
Returns
- IAsyncEnumerable<NatsMsg<TReply>>
An asynchronous enumerable of NatsMsg<T> objects
Type Parameters
TRequest
Request type
TReply
Reply type
Remarks
if reply option's timeout is not defined then it will be set to NatsOpts.RequestTimeout.
Exceptions
- OperationCanceledException
Raised when cancellation token is used