Class RemoteConnectionCore
represents a connection to a remote server that hosts command and event handlers
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Remote.Core.dll
Syntax
public class RemoteConnectionCore
Fields
Channel
Declaration
protected GrpcChannel? Channel
Field Value
Type | Description |
---|---|
GrpcChannel |
ExecutorMap
Declaration
protected readonly Dictionary<Type, ICommandExecutor> ExecutorMap
Field Value
Type | Description |
---|---|
Dictionary<Type, ICommandExecutor> |
ServiceProvider
Declaration
protected readonly IServiceProvider ServiceProvider
Field Value
Type | Description |
---|---|
IServiceProvider |
Properties
ChannelOptions
grpc channel settings
Declaration
public GrpcChannelOptions ChannelOptions { get; set; }
Property Value
Type | Description |
---|---|
GrpcChannelOptions |
RemoteAddress
the address of the remote server
Declaration
public string RemoteAddress { get; }
Property Value
Type | Description |
---|---|
string |
Methods
RegisterClientStream<T, TResult>()
register a remote handler for a "client stream" (IAsyncEnumerable<T>) for this remote connection.
Declaration
public void RegisterClientStream<T, TResult>() where T : class where TResult : class
Type Parameters
Name | Description |
---|---|
T | the type of the items in the stream |
TResult | the type of the result that will be received when the stream ends |
RegisterServerStream<TCommand, TResult>()
register a "server stream" command (IServerStreamCommand<TResult>) for this remote connection where the handler for it is hosted/located.
Declaration
public void RegisterServerStream<TCommand, TResult>() where TCommand : class, IServerStreamCommand<TResult> where TResult : class
Type Parameters
Name | Description |
---|---|
TCommand | the type of the command |
TResult | the type of the result stream |
Register<TCommand>()
register a "void" command (ICommand) for this remote connection where the handler for it is hosted/located.
Declaration
public void Register<TCommand>() where TCommand : class, ICommand
Type Parameters
Name | Description |
---|---|
TCommand | the type of the command |
Register<TCommand, TResult>()
register a "unary" command (ICommand<TResult>) for this remote connection where the handler for it is hosted/located.
Declaration
public void Register<TCommand, TResult>() where TCommand : class, ICommand<TResult> where TResult : class
Type Parameters
Name | Description |
---|---|
TCommand | the type of the command |
TResult | the type of the result |
Subscribe<TEvent, TEventHandler>(CallOptions, string)
subscribe to a broadcast channel for a given event type (TEvent
) on the remote host.
the received events will be handled by the specified handler (TEventHandler
) on this machine.
Declaration
public void Subscribe<TEvent, TEventHandler>(CallOptions callOptions = default, string clientIdentifier = "default") where TEvent : class, IEvent where TEventHandler : IEventHandler<TEvent>
Parameters
Type | Name | Description |
---|---|---|
CallOptions | callOptions | the call options |
string | clientIdentifier | a unique identifier for this client. this will be used to create a durable subscriber id which will allow the server to uniquely identify this subscriber/client across disconnections. if you don't set this value, only one subscriber from a single machine is possible. i.e. if you spin up multiple instances of this subscriber they will all connect to the server with the same subscriber id, which will result in unpredictable event receiving behavior. |
Type Parameters
Name | Description |
---|---|
TEvent | the type of the events that will be received |
TEventHandler | the handler that will be handling the received events |