Interface IDependencyInjector
- Namespace
- CarrotMQ.Core.MessageProcessing
- Assembly
- CarrotMQ.Core.dll
Interface used as abstraction between CarrotMQ and your DI framework. It contains methods for the creation of all types, CarrotMQ.RabbitMQ needs to be able to instantiate dynamically.
public interface IDependencyInjector : IAsyncDisposable
- Inherited Members
Methods
CreateAsyncScope()
Creates a new scope for dependency resolution.
IDependencyInjector CreateAsyncScope()
Returns
- IDependencyInjector
An instance of IDependencyInjector representing the new scope.
Remarks
A new scope is created for each incoming message
CreateHandler<THandler, TMessage, TResponse>()
Creates a handler for processing messages of type TMessage with response type
TResponse.
THandler? CreateHandler<THandler, TMessage, TResponse>() where THandler : HandlerBase<TMessage, TResponse> where TMessage : _IMessage<TMessage, TResponse> where TResponse : class
Returns
- THandler
An instance of the handler specified by
THandler.
Type Parameters
THandlerThe type of the handler to be created.
TMessageThe type of the message to be handled.
TResponseThe type of the response produced by the handler.
Remarks
All handlers that where registered must be able to be instantiated by this method (EventHandlerBase<TEvent>, CommandHandlerBase<TCommand, TResponse>, QueryHandlerBase<TQuery, TResponse>, ResponseHandlerBase<TRequest, TResponse>)
GetCarrotSerializer()
Gets the ICarrotSerializer that is used to serialize and deserialize the payload of a CarrotMQ message.
ICarrotSerializer GetCarrotSerializer()
Returns
GetMiddlewareProcessor()
Gets the IMiddlewareProcessor.
IMiddlewareProcessor GetMiddlewareProcessor()