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
resolverFactoryIDependencyResolverFactoryThe resolver factory.
serializerIMessageSerializerThe serializer.
filtersIEnumerable<IMessageFilter>The filters.
errorHandlersIEnumerable<IErrorHandler>The error handlers.
envelopeFactoryIMessageEnvelopeFactoryThe message metadata factory.
logWriterFactoryILogWriterFactoryThe logging writer factory.
payloadMaterializerLargePayloadMaterializerThe optional inbound payload processor.
payloadOffloaderLargePayloadOffloaderThe 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
registrationServerRegistrationThe registration.
methodContractMethodDescriptorThe method.
envelopeTransportEnvelopeThe transport envelope to process.
transportIMessagingProtocolThe transport.
cancellationTokenCancellationTokenThe token used to cancel the operation.
protocolProtocolKey?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
registrationEventRegistrationThe registration.
envelopeTransportEnvelopeThe transport envelope to process.
transportIMessagingProtocolThe transport.
cancellationTokenCancellationTokenThe 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
envelopeTransportEnvelopeThe transport envelope to process.
transportIMessagingProtocolThe transport.
messagestringThe message payload or description.
cancellationTokenCancellationTokenThe 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
registrationServerRegistrationThe registration.
methodContractMethodDescriptorThe method.
envelopeTransportEnvelopeThe transport envelope to process.
transportIMessagingProtocolThe transport.
cancellationTokenCancellationTokenThe token used to cancel the operation.
protocolProtocolKey?The protocol registration key.
Returns
- IAsyncEnumerable<TransportEnvelope>
An asynchronous sequence of values produced by the operation.