Table of Contents

Class HandlerCollection

Namespace
CarrotMQ.Core.Configuration
Assembly
CarrotMQ.Core.dll
public class HandlerCollection
Inheritance
HandlerCollection
Inherited Members

Constructors

HandlerCollection(IServiceCollection, BindingCollection)

public HandlerCollection(IServiceCollection serviceCollection, BindingCollection bindingCollection)

Parameters

serviceCollection IServiceCollection
bindingCollection BindingCollection

Methods

AddCommand<TCommandHandler, TCommand, TResponse>()

Registers a command handler in the service configuration.

public Handler<TCommand, TResponse> AddCommand<TCommandHandler, TCommand, TResponse>() where TCommandHandler : CommandHandlerBase<TCommand, TResponse> where TCommand : class, _ICommand<TCommand, TResponse> where TResponse : class

Returns

Handler<TCommand, TResponse>

Type Parameters

TCommandHandler

The type of the command handler.

TCommand

The type of the command.

TResponse

The type of the response.

Remarks

This method registers the specified TCommandHandler in the CarrotMQ messaging service configuration.

AddCustomRoutingEventSubscription<TCustomRoutingEvent>()

Registers an event subscription for a ICustomRoutingEvent<TEvent>.

public void AddCustomRoutingEventSubscription<TCustomRoutingEvent>() where TCustomRoutingEvent : class, ICustomRoutingEvent<TCustomRoutingEvent>

Type Parameters

TCustomRoutingEvent

The type of the event.

Remarks

Registers a EventSubscription<TEvent> in the service collection which can be injected in your classes. You can then use EventReceived to receive the events.

AddCustomRoutingEvent<TEventHandler, TCustomRoutingEvent>()

Registers an event handler for a ICustomRoutingEvent<TEvent> in service configuration.

public void AddCustomRoutingEvent<TEventHandler, TCustomRoutingEvent>() where TEventHandler : EventHandlerBase<TCustomRoutingEvent> where TCustomRoutingEvent : class, ICustomRoutingEvent<TCustomRoutingEvent>

Type Parameters

TEventHandler

The type of the event handler.

TCustomRoutingEvent

The type of the event.

Remarks

This method registers the specified TEventHandler in the CarrotMQ messaging service configuration.

AddEventSubscription<TEvent>()

Registers an event subscription for a IEvent<TEvent, TExchangeEndPoint>.

public Handler<TEvent, NoResponse> AddEventSubscription<TEvent>() where TEvent : class, _IEvent<TEvent>

Returns

Handler<TEvent, NoResponse>

Type Parameters

TEvent

The type of the event.

Remarks

Registers a EventSubscription<TEvent> in the service collection which can be injected in your classes. You can then use EventReceived to receive the events.

AddEvent<TEventHandler, TEvent>()

Registers an event handler in service configuration.

public Handler<TEvent, NoResponse> AddEvent<TEventHandler, TEvent>() where TEventHandler : EventHandlerBase<TEvent> where TEvent : class, _IEvent<TEvent>

Returns

Handler<TEvent, NoResponse>

Type Parameters

TEventHandler

The type of the event handler.

TEvent

The type of the event.

Remarks

This method registers the specified TEventHandler in the CarrotMQ messaging service configuration.

AddQuery<TQueryHandler, TQuery, TResponse>()

Registers a query handler in the service configuration.

public Handler<TQuery, TResponse> AddQuery<TQueryHandler, TQuery, TResponse>() where TQueryHandler : QueryHandlerBase<TQuery, TResponse> where TQuery : class, _IQuery<TQuery, TResponse> where TResponse : class

Returns

Handler<TQuery, TResponse>

Type Parameters

TQueryHandler

The type of the query handler.

TQuery

The type of the query.

TResponse

The type of the response.

Remarks

This method registers the specified TQueryHandler in the CarrotMQ messaging service configuration.

AddResponseSubscription<TRequest, TResponse>()

Registers a response subscription.

public void AddResponseSubscription<TRequest, TResponse>() where TRequest : class, _IRequest<TRequest, TResponse> where TResponse : class

Type Parameters

TRequest

The type of the request.

TResponse

The type of the response.

Remarks

Registers a ResponseSubscription<TRequest, TResponse> in the service collection which can be injected in your classes. You can then use ResponseSubscription<TRequest, TResponse> to receive the responses.

AddResponse<TResponseHandler, TRequest, TResponse>()

Registers a response handler in the service configuration.

public void AddResponse<TResponseHandler, TRequest, TResponse>() where TResponseHandler : ResponseHandlerBase<TRequest, TResponse> where TRequest : class, _IRequest<TRequest, TResponse> where TResponse : class

Type Parameters

TResponseHandler

The type of the response handler.

TRequest

The type of the request.

TResponse

The type of the response.

Remarks

This method registers the specified TResponseHandler in the CarrotMQ messaging service configuration.

GetHandlers()

Gets all registered handlers in the configuration.

public IDictionary<string, HandlerProcessorBase> GetHandlers()

Returns

IDictionary<string, HandlerProcessorBase>

A dictionary of handler keys and associated handler processors.