Class MessageHandler
Represents base class for declaring typed message handlers.
Inherited Members
Namespace: DotNext.Net.Cluster.Messaging
Assembly: DotNext.Net.Cluster.dll
Syntax
public class MessageHandler : IBuildable<MessageHandler, MessageHandler.Builder>, IInputChannel
Remarks
The handler can be constructed in two ways: using MessageHandler.Builder and through inheritance. If you choose the inheritance then message handlers must be declared as public instance methods with one of the following signatures:
// duplex message handlers
Task<Result> HandleAsync(InputMessage input, CancellationToken token);
Task<Result> HandleAsync(ISubscriber sender, InputMessage input, CancellationToken token);
Task<Result> HandleAsync(InputMessage input, object? context, CancellationToken token);
Task<Result> HandleAsync(ISubscriber sender, InputMessage input, object? context, CancellationToken token);
// signal message handlers
Task HandleAsync(InputMessage input, CancellationToken token);
Task HandleAsync(ISubscriber sender, InputMessage input, CancellationToken token);
Task HandleAsync(InputMessage input, object? context, CancellationToken token);
Task HandleAsync(ISubscriber sender, InputMessage input, object? context, CancellationToken token);
Otherwise, command handlers can be registered through the builder.
Constructors
| Edit this page View SourceMessageHandler()
Initializes a new typed message handler and discover all methods suitable for handling messages.
Declaration
protected MessageHandler()