Class RemoteConnectionExtensions
client extension methods
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Remote.dll
Syntax
public static class RemoteConnectionExtensions
Methods
AddEventSubscriberStorageProvider<TStorageRecord, TStorageProvider>(IServiceCollection)
register a custom event subscriber storage provider
Declaration
public static void AddEventSubscriberStorageProvider<TStorageRecord, TStorageProvider>(this IServiceCollection services) where TStorageRecord : IEventStorageRecord, new() where TStorageProvider : class, IEventSubscriberStorageProvider<TStorageRecord>
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services |
Type Parameters
Name | Description |
---|---|
TStorageRecord | the type of the storage record |
TStorageProvider |
MapRemote(IHost, string, Action<RemoteConnection>)
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>(CallOptions) method.
Declaration
public static IHost MapRemote(this IHost host, string remoteAddress, Action<RemoteConnection> r)
Parameters
Type | Name | Description |
---|---|---|
IHost | host | |
string | remoteAddress | the address of the remote server |
Action<RemoteConnection> | r | a configuration action for the connection |
Returns
Type | Description |
---|---|
IHost |
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 |
RemotePublishAsync(IEvent, CallOptions)
publish the event to the relevant remote server that's running in EventBroker
Declaration
public static Task RemotePublishAsync(this IEvent @event, CallOptions options = default)
Parameters
Type | Name | Description |
---|---|---|
IEvent | event | |
CallOptions | options | call options |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | thrown if the relevant remote handler has not been registered |