Class FuncMessageHandler<TMessage>
A function message handler.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Messaging
Assembly: Kephas.Messaging.dll
Syntax
public class FuncMessageHandler<TMessage> : MessageHandlerBase<TMessage, IMessage>, ILoggable, IMessageHandler<TMessage>, IMessageHandler, IDisposable where TMessage : class
Type Parameters
Name | Description |
---|---|
TMessage | Type of the message. |
Constructors
| Improve this Doc View SourceFuncMessageHandler(Func<TMessage, IMessagingContext, CancellationToken, Task<IMessage>>)
Initializes a new instance of the FuncMessageHandler<TMessage> class.
Declaration
public FuncMessageHandler(Func<TMessage, IMessagingContext, CancellationToken, Task<IMessage>> handlerFunction)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TMessage, IMessagingContext, System.Threading.CancellationToken, System.Threading.Tasks.Task<IMessage>> | handlerFunction | The handler function. |
Methods
| Improve this Doc View SourceProcessAsync(TMessage, IMessagingContext, CancellationToken)
Processes the provided message asynchronously and returns a response promise.
Declaration
public override Task<IMessage> ProcessAsync(TMessage message, IMessagingContext context, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The message to be handled. |
IMessagingContext | context | The processing context. |
System.Threading.CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | The response promise. |
Overrides
Kephas.Messaging.MessageHandlerBase<TMessage, Kephas.Messaging.IMessage>.ProcessAsync(TMessage, Kephas.Messaging.IMessagingContext, System.Threading.CancellationToken)
Implements
System.IDisposable