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 app.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<TResult>(ICommand<TResult>, CallOptions)
execute the command on the relevant remote server and get back a 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>(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<T, TResult>(IAsyncEnumerable<T>, CallOptions)
send the stream of T
to the relevant remote server and get back a result of TResult
Declaration
public static Task<TResult> RemoteExecuteAsync<T, TResult>(this IAsyncEnumerable<T> commands, CallOptions options = default) where T : class where TResult : class
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<T> | commands | the stream to send |
CallOptions | options | call options |
Returns
Type | Description |
---|---|
Task<TResult> |
Type Parameters
Name | Description |
---|---|
T | the type of item 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 |