Table of Contents

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 IApplicationContext
executor TaskScheduler
logger ILogger

Fields

_context

protected readonly IApplicationContext _context

Field Value

IApplicationContext

_executor

protected readonly TaskScheduler _executor

Field Value

TaskScheduler

_factory

protected readonly TaskFactory _factory

Field Value

TaskFactory

_handlers

protected List<IMessageHandler> _handlers

Field Value

List<IMessageHandler>

_logger

protected readonly ILogger _logger

Field Value

ILogger

Properties

ErrorHandler

public virtual IErrorHandler ErrorHandler { get; set; }

Property Value

IErrorHandler

Failover

Gets or sets a value indicating whether this dispatcher should failover upon a dispatching error

public virtual bool Failover { get; set; }

Property Value

bool

HandlerCount

Gets the current handler count

public virtual int HandlerCount { get; }

Property Value

int

IntegrationServices

public virtual IIntegrationServices IntegrationServices { get; }

Property Value

IIntegrationServices

LoadBalancingStrategy

Gets or sets the load balancing strategy in use by the dispatcher

public virtual ILoadBalancingStrategy LoadBalancingStrategy { get; set; }

Property Value

ILoadBalancingStrategy

MaxSubscribers

Gets or sets the maximum number of subscribers this dispatcher supports

public virtual int MaxSubscribers { get; set; }

Property Value

int

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

IMessageHandlingDecorator

Methods

AddHandler(IMessageHandler)

Adds a handler to the dispatcher

public virtual bool AddHandler(IMessageHandler handler)

Parameters

handler IMessageHandler

the 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 IMessage

the message to dispatch

cancellationToken CancellationToken

token 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 IMessage
cancellationToken CancellationToken

Returns

bool

RemoveHandler(IMessageHandler)

Remove the specified handler from the dispatcher

public virtual bool RemoveHandler(IMessageHandler handler)

Parameters

handler IMessageHandler

the 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

Returns

bool