Class RemoteConnectionCoreExtensions
client extension methods
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Remote.Core.dll
Syntax
public static class RemoteConnectionCoreExtensions
Methods
MapRemoteCore(IServiceProvider, string, Action<RemoteConnectionCore>)
creates a grpc channel/connection to a remote server that hosts a known collection of command handlers and event hubs.
IMPORTANT: call the Register<TCommand, TResult>() method (using action r) to specify which commands are
handled by this remote server. event subscriptions can be specified using .Subscribe<TEvent, TEventHandler>() method.
Declaration
public static IServiceProvider MapRemoteCore(this IServiceProvider services, string remoteAddress, Action<RemoteConnectionCore> r)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | services | |
| string | remoteAddress | the address of the remote server |
| Action<RemoteConnectionCore> | r | a configuration action for the connection |
Returns
| Type | Description |
|---|---|
| IServiceProvider |
RemoteExecuteAsync(ICommand, CallOptions)
execute the command on the relevant remote server
Declaration
public static Task RemoteExecuteAsync(this ICommand command, CallOptions options = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommand | command | |
| CallOptions | options | call options |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync(ICommand, CancellationToken)
execute the command on the relevant remote server
Declaration
public static Task RemoteExecuteAsync(this ICommand command, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommand | command | |
| CancellationToken | ct | cancellation token |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TResult>(ICommand<TResult>, CallOptions)
execute the command on the relevant remote server and get back a TResult result
Declaration
public static Task<TResult> RemoteExecuteAsync<TResult>(this ICommand<TResult> command, CallOptions options = default) where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| ICommand<TResult> | command | |
| CallOptions | options | call options |
Returns
| Type | Description |
|---|---|
| Task<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult | the type of the result |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TResult>(ICommand<TResult>, CancellationToken)
execute the command on the relevant remote server and get back a TResult result
Declaration
public static Task<TResult> RemoteExecuteAsync<TResult>(this ICommand<TResult> command, CancellationToken ct) where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| ICommand<TResult> | command | |
| CancellationToken | ct | cancellation token |
Returns
| Type | Description |
|---|---|
| Task<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult | the type of the result |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TResult>(IServerStreamCommand<TResult>, CallOptions)
execute the command on the relevant remote server and get back a stream of TResult
Declaration
public static IAsyncEnumerable<TResult> RemoteExecuteAsync<TResult>(this IServerStreamCommand<TResult> command, CallOptions options = default) where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| IServerStreamCommand<TResult> | command | |
| CallOptions | options | call options |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult | the type of the result stream |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TResult>(IServerStreamCommand<TResult>, CancellationToken)
execute the command on the relevant remote server and get back a stream of TResult
Declaration
public static IAsyncEnumerable<TResult> RemoteExecuteAsync<TResult>(this IServerStreamCommand<TResult> command, CancellationToken ct) where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| IServerStreamCommand<TResult> | command | |
| CancellationToken | ct | cancellation token |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TResult | the type of the result stream |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TCommand, TResult>(IAsyncEnumerable<TCommand>, CallOptions)
send the stream of TCommand commands to the relevant remote server and get back a result of TResult
Declaration
public static Task<TResult> RemoteExecuteAsync<TCommand, TResult>(this IAsyncEnumerable<TCommand> commands, CallOptions options = default) where TCommand : class where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TCommand> | commands | the stream to send |
| CallOptions | options | call options |
Returns
| Type | Description |
|---|---|
| Task<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TCommand | the type of command in the stream |
| TResult | the type of the result that will be returned when the stream ends |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |
RemoteExecuteAsync<TCommand, TResult>(IAsyncEnumerable<TCommand>, CancellationToken)
send the stream of TCommand commands to the relevant remote server and get back a result of TResult
Declaration
public static Task<TResult> RemoteExecuteAsync<TCommand, TResult>(this IAsyncEnumerable<TCommand> commands, CancellationToken ct) where TCommand : class where TResult : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TCommand> | commands | the stream to send |
| CancellationToken | ct | cancellation token |
Returns
| Type | Description |
|---|---|
| Task<TResult> |
Type Parameters
| Name | Description |
|---|---|
| TCommand | the type of command in the stream |
| TResult | the type of the result that will be returned when the stream ends |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | thrown if the relevant remote handler has not been registered |