Class Messenger
Represents helper methods allow to communicate with remove cluster members through network.
Inherited Members
Namespace: DotNext.Net.Cluster.Messaging
Assembly: DotNext.Net.Cluster.dll
Syntax
public static class Messenger
Methods
| Improve this Doc View SourceReadAsTextAsync(IMessage, CancellationToken)
Converts message content into string.
Declaration
public static Task<string> ReadAsTextAsync(this IMessage message, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IMessage | message | The message to read. |
CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
Type | Description |
---|---|
Task<String> | The content of the message. |
SendBroadcastSignalAsync(IMessageBus, IMessage, Boolean)
Send broadcast one-way message to all members in the cluster except local member.
Declaration
public static Task SendBroadcastSignalAsync(this IMessageBus cluster, IMessage message, bool requiresConfirmation = true)
Parameters
Type | Name | Description |
---|---|---|
IMessageBus | cluster | The cluster of nodes. |
IMessage | message | The message to be sent. |
Boolean | requiresConfirmation | true to wait for confirmation of delivery from receiver; otherwise, false. |
Returns
Type | Description |
---|---|
Task | The task representing asynchronous execution of broadcasting. |
SendTextMessageAsync<TResponse>(ISubscriber, MessageReader<TResponse>, String, String, String, CancellationToken)
Send synchronous text message.
Declaration
public static Task<TResponse> SendTextMessageAsync<TResponse>(this ISubscriber messenger, MessageReader<TResponse> responseReader, string messageName, string text, string mediaType = null, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ISubscriber | messenger | The receiver of the message. |
MessageReader<TResponse> | responseReader | The response reader. |
String | messageName | The name of the message. |
String | text | The content of the message. |
String | mediaType | The media type of the message content. |
CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
Type | Description |
---|---|
Task<TResponse> | The reply message. |
Type Parameters
Name | Description |
---|---|
TResponse | The type of the parsed response message. |
SendTextSignalAsync(ISubscriber, String, String, Boolean, String, CancellationToken)
Send one-way text message.
Declaration
public static Task SendTextSignalAsync(this ISubscriber messenger, string messageName, string text, bool requiresConfirmation = true, string mediaType = null, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ISubscriber | messenger | The receiver of the message. |
String | messageName | The name of the message. |
String | text | The content of the message. |
Boolean | requiresConfirmation | true to wait for confirmation of delivery from receiver; otherwise, false. |
String | mediaType | The media type of the message content. |
CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
Type | Description |
---|---|
Task | The task representing asynchronous execution of the method. |