Method JSRequestResponseAsync
JSRequestResponseAsync<TRequest, TResponse>(string, TRequest?, CancellationToken)
Sends a request message to a JetStream subject and waits for a response.
public ValueTask<TResponse> JSRequestResponseAsync<TRequest, TResponse>(string subject, TRequest? request, CancellationToken cancellationToken = default) where TRequest : class where TResponse : class
Parameters
subject
stringThe JetStream API subject to send the request to.
request
TRequestThe request message object.
cancellationToken
CancellationTokenA CancellationToken used to cancel the API call.
Returns
- ValueTask<TResponse>
A task representing the asynchronous operation, with a result of type
TResponse
.
Type Parameters
TRequest
The type of the request message.
TResponse
The type of the response message.