Class RemoteDispatcher
- Namespace
- Arbiter.CommandQuery.Dispatcher
- Assembly
- Arbiter.CommandQuery.dll
A dispatcher that sends requests to a remote service over HTTP. Use for Blazor Interactive WebAssembly rendering mode.
public class RemoteDispatcher : IDispatcher
- Inheritance
-
RemoteDispatcher
- Implements
- Inherited Members
Constructors
RemoteDispatcher(HttpClient, JsonSerializerOptions, IOptions<DispatcherOptions>, HybridCache?)
Initializes a new instance of the RemoteDispatcher class.
public RemoteDispatcher(HttpClient httpClient, JsonSerializerOptions serializerOptions, IOptions<DispatcherOptions> dispatcherOptions, HybridCache? hybridCache = null)
Parameters
httpClient
HttpClientThe HTTP client to send request over
serializerOptions
JsonSerializerOptionsThe JSON options to use for serialization
dispatcherOptions
IOptions<DispatcherOptions>The dispatcher options to use
hybridCache
HybridCacheThe optional hybrid cache to use.
Methods
Send<TResponse>(IRequest<TResponse>, CancellationToken)
Sends a request to the message dispatcher.
public ValueTask<TResponse?> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default)
Parameters
request
IRequest<TResponse>The request being sent
cancellationToken
CancellationTokenCancellation token
Returns
- ValueTask<TResponse>
Awaitable task returning the
TResponse
Type Parameters
TResponse
The type of response from the dispatcher
Send<TRequest, TResponse>(TRequest, CancellationToken)
Sends a request to the message dispatcher.
public ValueTask<TResponse?> Send<TRequest, TResponse>(TRequest request, CancellationToken cancellationToken = default) where TRequest : IRequest<TResponse>
Parameters
request
TRequestThe request being sent
cancellationToken
CancellationTokenCancellation token
Returns
- ValueTask<TResponse>
Awaitable task returning the
TResponse
Type Parameters
TRequest
The type of request being sent
TResponse
The type of response from the dispatcher