Table of Contents

Class MessageDispatcher

Namespace
AnyProtocol
Assembly
AnyProtocol.dll

Composes the request, stream, event, and fault dispatch paths.

public sealed class MessageDispatcher
Inheritance
MessageDispatcher
Inherited Members

Constructors

MessageDispatcher(IDependencyResolverFactory, IMessageSerializer, IEnumerable<IMessageFilter>?, IEnumerable<IErrorHandler>?, IMessageEnvelopeFactory?, ILogWriterFactory?, LargePayloadMaterializer?, LargePayloadOffloader?)

Initializes a new instance of the MessageDispatcher class.

public MessageDispatcher(IDependencyResolverFactory resolverFactory, IMessageSerializer serializer, IEnumerable<IMessageFilter>? filters = null, IEnumerable<IErrorHandler>? errorHandlers = null, IMessageEnvelopeFactory? envelopeFactory = null, ILogWriterFactory? logWriterFactory = null, LargePayloadMaterializer? payloadMaterializer = null, LargePayloadOffloader? payloadOffloader = null)

Parameters

resolverFactory IDependencyResolverFactory

The resolver factory.

serializer IMessageSerializer

The serializer.

filters IEnumerable<IMessageFilter>

The filters.

errorHandlers IEnumerable<IErrorHandler>

The error handlers.

envelopeFactory IMessageEnvelopeFactory

The message metadata factory.

logWriterFactory ILogWriterFactory

The logging writer factory.

payloadMaterializer LargePayloadMaterializer

The optional inbound payload processor.

payloadOffloader LargePayloadOffloader

The optional outbound payload processor.

Methods

DispatchAsync(ServerRegistration, ContractMethodDescriptor, TransportEnvelope, IMessagingProtocol, CancellationToken, ProtocolKey?)

Performs the dispatch async operation.

public ValueTask DispatchAsync(ServerRegistration registration, ContractMethodDescriptor method, TransportEnvelope envelope, IMessagingProtocol transport, CancellationToken cancellationToken = default, ProtocolKey? protocol = null)

Parameters

registration ServerRegistration

The registration.

method ContractMethodDescriptor

The method.

envelope TransportEnvelope

The transport envelope to process.

transport IMessagingProtocol

The transport.

cancellationToken CancellationToken

The token used to cancel the operation.

protocol ProtocolKey?

The protocol registration key.

Returns

ValueTask

A task that represents the asynchronous operation.

DispatchEventAsync(EventRegistration, TransportEnvelope, IMessagingProtocol, CancellationToken)

Performs the dispatch event async operation.

public ValueTask DispatchEventAsync(EventRegistration registration, TransportEnvelope envelope, IMessagingProtocol transport, CancellationToken cancellationToken = default)

Parameters

registration EventRegistration

The registration.

envelope TransportEnvelope

The transport envelope to process.

transport IMessagingProtocol

The transport.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask

A task that represents the asynchronous operation.

DispatchRoutingFaultAsync(TransportEnvelope, IMessagingProtocol, string, CancellationToken)

Performs the dispatch routing fault async operation.

public ValueTask DispatchRoutingFaultAsync(TransportEnvelope envelope, IMessagingProtocol transport, string message, CancellationToken cancellationToken = default)

Parameters

envelope TransportEnvelope

The transport envelope to process.

transport IMessagingProtocol

The transport.

message string

The message payload or description.

cancellationToken CancellationToken

The token used to cancel the operation.

Returns

ValueTask

A task that represents the asynchronous operation.

DispatchStreamAsync(ServerRegistration, ContractMethodDescriptor, TransportEnvelope, IMessagingProtocol, CancellationToken, ProtocolKey?)

Performs the dispatch stream async operation.

public IAsyncEnumerable<TransportEnvelope> DispatchStreamAsync(ServerRegistration registration, ContractMethodDescriptor method, TransportEnvelope envelope, IMessagingProtocol transport, CancellationToken cancellationToken = default, ProtocolKey? protocol = null)

Parameters

registration ServerRegistration

The registration.

method ContractMethodDescriptor

The method.

envelope TransportEnvelope

The transport envelope to process.

transport IMessagingProtocol

The transport.

cancellationToken CancellationToken

The token used to cancel the operation.

protocol ProtocolKey?

The protocol registration key.

Returns

IAsyncEnumerable<TransportEnvelope>

An asynchronous sequence of values produced by the operation.