Class MessageHandler.Builder
Represents builder of message handlers.
Inherited Members
Namespace: DotNext.Net.Cluster.Messaging
Assembly: DotNext.Net.Cluster.dll
Syntax
public sealed class MessageHandler.Builder : ISupplier<MessageHandler>, IFunctional<Func<MessageHandler>>, IResettable
Constructors
| Edit this page View SourceBuilder()
Initializes a new builder.
Declaration
public Builder()
Methods
| Edit this page View SourceAdd<TInput>(string, Func<ISubscriber, TInput, object?, CancellationToken, Task>)
Registers signal handler.
Declaration
public MessageHandler.Builder Add<TInput>(string messageName, Func<ISubscriber, TInput, object?, CancellationToken, Task> signalHandler) where TInput : notnull, ISerializable<TInput>
Parameters
Type | Name | Description |
---|---|---|
string | messageName | The name of the message. |
Func<ISubscriber, TInput, object, CancellationToken, Task> | signalHandler | The handler. |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the message. |
Add<TInput>(string, Func<ISubscriber, TInput, CancellationToken, Task>)
Registers signal handler.
Declaration
public MessageHandler.Builder Add<TInput>(string messageName, Func<ISubscriber, TInput, CancellationToken, Task> signalHandler) where TInput : notnull, ISerializable<TInput>
Parameters
Type | Name | Description |
---|---|---|
string | messageName | The name of the message. |
Func<ISubscriber, TInput, CancellationToken, Task> | signalHandler | The handler. |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the message. |
Add<TInput>(string, Func<TInput, object?, CancellationToken, Task>)
Registers signal handler.
Declaration
public MessageHandler.Builder Add<TInput>(string messageName, Func<TInput, object?, CancellationToken, Task> signalHandler) where TInput : notnull, ISerializable<TInput>
Parameters
Type | Name | Description |
---|---|---|
string | messageName | The name of the message. |
Func<TInput, object, CancellationToken, Task> | signalHandler | The handler. |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the message. |
Add<TInput>(string, Func<TInput, CancellationToken, Task>)
Registers signal handler.
Declaration
public MessageHandler.Builder Add<TInput>(string messageName, Func<TInput, CancellationToken, Task> signalHandler) where TInput : notnull, ISerializable<TInput>
Parameters
Type | Name | Description |
---|---|---|
string | messageName | The name of the message. |
Func<TInput, CancellationToken, Task> | signalHandler | The handler. |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the message. |
Add<TInput, TOutput>(string, Func<ISubscriber, TInput, object?, CancellationToken, Task<TOutput>>, string, string?)
Registers duplex message handler.
Declaration
public MessageHandler.Builder Add<TInput, TOutput>(string inputMessageName, Func<ISubscriber, TInput, object?, CancellationToken, Task<TOutput>> messageHandler, string outputMessageName, string? outputMessageType = null) where TInput : notnull, ISerializable<TInput> where TOutput : notnull, ISerializable<TOutput>
Parameters
Type | Name | Description |
---|---|---|
string | inputMessageName | The name of |
Func<ISubscriber, TInput, object, CancellationToken, Task<TOutput>> | messageHandler | The message handler. |
string | outputMessageName | The name of |
string | outputMessageType | MIME type of |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the input message. |
TOutput | The type of the output message. |
Add<TInput, TOutput>(string, Func<ISubscriber, TInput, CancellationToken, Task<TOutput>>, string, string?)
Registers duplex message handler.
Declaration
public MessageHandler.Builder Add<TInput, TOutput>(string inputMessageName, Func<ISubscriber, TInput, CancellationToken, Task<TOutput>> messageHandler, string outputMessageName, string? outputMessageType = null) where TInput : notnull, ISerializable<TInput> where TOutput : notnull, ISerializable<TOutput>
Parameters
Type | Name | Description |
---|---|---|
string | inputMessageName | The name of |
Func<ISubscriber, TInput, CancellationToken, Task<TOutput>> | messageHandler | The message handler. |
string | outputMessageName | The name of |
string | outputMessageType | MIME type of |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the input message. |
TOutput | The type of the output message. |
Add<TInput, TOutput>(string, Func<TInput, object?, CancellationToken, Task<TOutput>>, string, string?)
Registers duplex message handler.
Declaration
public MessageHandler.Builder Add<TInput, TOutput>(string inputMessageName, Func<TInput, object?, CancellationToken, Task<TOutput>> messageHandler, string outputMessageName, string? outputMessageType = null) where TInput : notnull, ISerializable<TInput> where TOutput : notnull, ISerializable<TOutput>
Parameters
Type | Name | Description |
---|---|---|
string | inputMessageName | The name of |
Func<TInput, object, CancellationToken, Task<TOutput>> | messageHandler | The message handler. |
string | outputMessageName | The name of |
string | outputMessageType | MIME type of |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the input message. |
TOutput | The type of the output message. |
Add<TInput, TOutput>(string, Func<TInput, CancellationToken, Task<TOutput>>, string, string?)
Registers duplex message handler.
Declaration
public MessageHandler.Builder Add<TInput, TOutput>(string inputMessageName, Func<TInput, CancellationToken, Task<TOutput>> messageHandler, string outputMessageName, string? outputMessageType = null) where TInput : notnull, ISerializable<TInput> where TOutput : notnull, ISerializable<TOutput>
Parameters
Type | Name | Description |
---|---|---|
string | inputMessageName | The name of |
Func<TInput, CancellationToken, Task<TOutput>> | messageHandler | The message handler. |
string | outputMessageName | The name of |
string | outputMessageType | MIME type of |
Returns
Type | Description |
---|---|
MessageHandler.Builder | This builder. |
Type Parameters
Name | Description |
---|---|
TInput | The type of the input message. |
TOutput | The type of the output message. |
Build()
Constructs message hander based on registered delegates.
Declaration
public MessageHandler Build()
Returns
Type | Description |
---|---|
MessageHandler | The constructed message handler. |
Reset()
Clears this builder so it can be reused.
Declaration
public void Reset()