Class AbstractDispatcher
- Namespace
- Steeltoe.Integration.Dispatcher
- Assembly
- Steeltoe.Integration.IntegrationBase.dll
public abstract class AbstractDispatcher : IMessageDispatcher
- Inheritance
-
AbstractDispatcher
- Implements
- Derived
- Inherited Members
Constructors
AbstractDispatcher(IApplicationContext, TaskScheduler, ILogger)
protected AbstractDispatcher(IApplicationContext context, TaskScheduler executor, ILogger logger = null)
Parameters
context
IApplicationContextexecutor
TaskSchedulerlogger
ILogger
Fields
_context
protected readonly IApplicationContext _context
Field Value
_executor
protected readonly TaskScheduler _executor
Field Value
_factory
protected readonly TaskFactory _factory
Field Value
_handlers
protected List<IMessageHandler> _handlers
Field Value
_logger
protected readonly ILogger _logger
Field Value
Properties
ErrorHandler
public virtual IErrorHandler ErrorHandler { get; set; }
Property Value
Failover
Gets or sets a value indicating whether this dispatcher should failover upon a dispatching error
public virtual bool Failover { get; set; }
Property Value
HandlerCount
Gets the current handler count
public virtual int HandlerCount { get; }
Property Value
IntegrationServices
public virtual IIntegrationServices IntegrationServices { get; }
Property Value
LoadBalancingStrategy
Gets or sets the load balancing strategy in use by the dispatcher
public virtual ILoadBalancingStrategy LoadBalancingStrategy { get; set; }
Property Value
MaxSubscribers
Gets or sets the maximum number of subscribers this dispatcher supports
public virtual int MaxSubscribers { get; set; }
Property Value
MessageHandlingDecorator
Gets or sets the message handling decorator that should be applied to the message for processing
public virtual IMessageHandlingDecorator MessageHandlingDecorator { get; set; }
Property Value
Methods
AddHandler(IMessageHandler)
Adds a handler to the dispatcher
public virtual bool AddHandler(IMessageHandler handler)
Parameters
handler
IMessageHandlerthe handler to add
Returns
- bool
true if added
Dispatch(IMessage, CancellationToken)
Dispatch the message to one or more handlers
public virtual bool Dispatch(IMessage message, CancellationToken cancellationToken = default)
Parameters
message
IMessagethe message to dispatch
cancellationToken
CancellationTokentoken used to cancel the operation
Returns
- bool
the value returned from the handler
DoDispatch(IMessage, CancellationToken)
protected abstract bool DoDispatch(IMessage message, CancellationToken cancellationToken)
Parameters
message
IMessagecancellationToken
CancellationToken
Returns
RemoveHandler(IMessageHandler)
Remove the specified handler from the dispatcher
public virtual bool RemoveHandler(IMessageHandler handler)
Parameters
handler
IMessageHandlerthe handler to remove
Returns
- bool
true if removed
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryOptimizedDispatch(IMessage)
protected virtual bool TryOptimizedDispatch(IMessage message)
Parameters
message
IMessage