Show / Hide Table of Contents

Class MessagingClient

Represents typed client for sending messages to the nodes in the cluster.

Inheritance
object
MessagingClient
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Net.Cluster.Messaging
Assembly: DotNext.Net.Cluster.dll
Syntax
public class MessagingClient

Constructors

| Edit this page View Source

MessagingClient(IOutputChannel)

Constructs a new typed client for messaging.

Declaration
public MessagingClient(IOutputChannel channel)
Parameters
Type Name Description
IOutputChannel channel

The output channel for outbound messages.

Exceptions
Type Condition
ArgumentNullException

channel is null.

Methods

| Edit this page View Source

GetMessageInfo<TMessage>()

Gets the name of MIME type by message type.

Declaration
protected virtual (string MessageName, ContentType MessageType) GetMessageInfo<TMessage>() where TMessage : ISerializable<TMessage>
Returns
Type Description
(string MessageName, ContentType MessageType)

The message name and MIME type.

Type Parameters
Name Description
TMessage

The type of the message.

Exceptions
Type Condition
GenericArgumentException<T>

TMessage is not registered via RegisterMessage<TMessage>(string, ContentType?).

| Edit this page View Source

RegisterMessage<TMessage>(MessageAttribute<TMessage>)

Registers message type and its type.

Declaration
public MessagingClient RegisterMessage<TMessage>(MessageAttribute<TMessage> messageInfo) where TMessage : ISerializable<TMessage>
Parameters
Type Name Description
MessageAttribute<TMessage> messageInfo

The information about message type.

Returns
Type Description
MessagingClient

This client.

Type Parameters
Name Description
TMessage

The type of the message payload.

| Edit this page View Source

RegisterMessage<TMessage>(string, ContentType?)

Registers message type and its type.

Declaration
public MessagingClient RegisterMessage<TMessage>(string name, ContentType? type = null) where TMessage : ISerializable<TMessage>
Parameters
Type Name Description
string name

The name of the message.

ContentType type

MIME type of the message.

Returns
Type Description
MessagingClient

This client.

Type Parameters
Name Description
TMessage

The type of the message payload.

| Edit this page View Source

SendMessageAsync<TInput, TOutput>(TInput, CancellationToken)

Sends a request message.

Declaration
public Task<TOutput> SendMessageAsync<TInput, TOutput>(TInput input, CancellationToken token = default) where TInput : ISerializable<TInput> where TOutput : ISerializable<TOutput>
Parameters
Type Name Description
TInput input

The request.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task<TOutput>

The response.

Type Parameters
Name Description
TInput

The type of the request.

TOutput

The type of the response.

Exceptions
Type Condition
InvalidOperationException

Attempts to send message to local or unavailable endpoint.

OperationCanceledException

The operation has been canceled.

| Edit this page View Source

SendSignalAsync<TInput>(TInput, CancellationToken)

Sends one-way message.

Declaration
public Task SendSignalAsync<TInput>(TInput input, CancellationToken token = default) where TInput : ISerializable<TInput>
Parameters
Type Name Description
TInput input

The message to send.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task

The task representing asynchronous execution of this method.

Type Parameters
Name Description
TInput

The type of the message.

Exceptions
Type Condition
InvalidOperationException

Attempts to send message to local or unavailable endpoint.

OperationCanceledException

The operation has been canceled.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾