Class InProcessMessageRouter
An in process message router invoking the message processor.
Inherited Members
Namespace: Kephas.Messaging.Distributed.Routing
Assembly: Kephas.Messaging.dll
Syntax
[ProcessingPriority(Priority.Lowest)]
public class InProcessMessageRouter : MessageRouterBase, ILoggable, IMessageRouter, IDisposable
Remarks
For the in-process message router, the DispatchAsync(IBrokeredMessage, IContext, CancellationToken) method represents the input queue.
Constructors
| Improve this Doc View SourceInProcessMessageRouter(IMessageProcessor, IExportFactory<IBrokeredMessageBuilder>, Lazy<IMessageBroker>)
Initializes a new instance of the InProcessMessageRouter class.
Declaration
public InProcessMessageRouter(IMessageProcessor messageProcessor, IExportFactory<IBrokeredMessageBuilder> messageBuilderFactory, Lazy<IMessageBroker> lazyMessageBroker)
Parameters
Type | Name | Description |
---|---|---|
IMessageProcessor | messageProcessor | The message processor. |
IExportFactory<IBrokeredMessageBuilder> | messageBuilderFactory | The message builder factory. |
System.Lazy<IMessageBroker> | lazyMessageBroker | The lazy message broker. |
Methods
| Improve this Doc View SourceDispatchAsync(IBrokeredMessage, IContext, CancellationToken)
Sends the brokered message asynchronously over the physical medium.
Declaration
public override Task<(RoutingInstruction action, IMessage reply)> DispatchAsync(IBrokeredMessage brokeredMessage, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | brokeredMessage | The brokered message. |
IContext | context | The routing context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<RoutingInstruction, IMessage>> | The asynchronous result yielding an action to take further and an optional reply. |
Overrides
| Improve this Doc View SourceProcessAsync(IBrokeredMessage, IContext, CancellationToken)
Processes the brokered message locally, asynchronously.
Declaration
protected override Task<IMessage> ProcessAsync(IBrokeredMessage brokeredMessage, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | brokeredMessage | The brokered message. |
IContext | context | The routing context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IMessage> | An asynchronous result that yields the reply message. |
Overrides
| Improve this Doc View SourceRouteOutputAsync(IBrokeredMessage, IContext, CancellationToken)
Routes the brokered message asynchronously, typically over the physical medium.
Declaration
protected override Task<(RoutingInstruction action, IMessage reply)> RouteOutputAsync(IBrokeredMessage brokeredMessage, IContext context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IBrokeredMessage | brokeredMessage | The brokered message. |
IContext | context | The send context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<RoutingInstruction, IMessage>> | The asynchronous result yielding an action to take further and an optional reply. |