C# Class SevenDigital.Messaging.MessageReceiving.HandlerManager

Message dispatcher keeps a set of bindings between message types and handler types. It uses a Work Wrapper to trigger handling of incoming messages.
Inheritance: IHandlerManager
显示文件 Open project: i-e-b/SevenDigital.Messaging

Public Methods

Method Description
AddHandler ( Type messageType, Type handlerType ) : void

Add a handler/message binding

CountHandlers ( ) : int

Return count of handlers

GetMatchingHandlers ( Type type ) : IEnumerable

List handlers that could process a given message type. More generic handlers will be returned for more specific message types

HandlerManager ( ISleepWrapper sleeper ) : System

New dispatcher

RemoveHandler ( Type handlerType ) : void

remove a handler for all messages

ShouldRetry ( Type exceptionType, Type handlerType ) : bool

Determines if a Handler is marked for retry of the given exception type

TryHandle ( IPendingMessage pendingMessage ) : void

Try to fire actions for a message

Private Methods

Method Description
FireHandledOkHooks ( IMessage msg, IEnumerable hooks ) : void
FireHandlerFailedHooks ( IMessage msg, IEnumerable hooks, Exception ex, Type handlerType ) : void
HandleMessageWithInstancesOfHandlers ( IPendingMessage pendingMessage, IEnumerable matchingHandlers, object messageObject ) : void
RetryFailedMessage ( IPendingMessage pendingMessage ) : void

Method Details

AddHandler() public method

Add a handler/message binding
public AddHandler ( Type messageType, Type handlerType ) : void
messageType System.Type
handlerType System.Type
return void

CountHandlers() public method

Return count of handlers
public CountHandlers ( ) : int
return int

GetMatchingHandlers() public method

List handlers that could process a given message type. More generic handlers will be returned for more specific message types
public GetMatchingHandlers ( Type type ) : IEnumerable
type System.Type
return IEnumerable

HandlerManager() public method

New dispatcher
public HandlerManager ( ISleepWrapper sleeper ) : System
sleeper ISleepWrapper
return System

RemoveHandler() public method

remove a handler for all messages
public RemoveHandler ( Type handlerType ) : void
handlerType System.Type
return void

ShouldRetry() public static method

Determines if a Handler is marked for retry of the given exception type
public static ShouldRetry ( Type exceptionType, Type handlerType ) : bool
exceptionType System.Type
handlerType System.Type
return bool

TryHandle() public method

Try to fire actions for a message
public TryHandle ( IPendingMessage pendingMessage ) : void
pendingMessage IPendingMessage
return void