C# Class paramore.brighter.commandprocessor.CommandProcessorBuilder

Class CommandProcessorBuilder. Provides a fluent interface to construct a CommandProcessor. We need to identify the following dependencies in order to create a CommandProcessor A HandlerConfiguration containing a IAmASubscriberRegistry and a IAmAHandlerFactory. You can use SubscriberRegistry to provide the IAmASubscriberRegistry but you need to implement your own IAmAHandlerFactory, for example using your preferred Inversion of Control (IoC) container A IAmAPolicyRegistry containing a list of policies that you want to be accessible to the CommandProcessor. You can use PolicyRegistry to provide the IAmAPolicyRegistry. Policies are expected to be Polly !:https://github.com/michael-wolfenden/Polly Policy references. If you do not need any policies around quality of service (QoS) concerns - you do not have Work Queues and/or do not intend to use Polly Policies for QoS concerns - you can use NoPolicy to indicate you do not need them. A ILog that is the logger to use for diagnostic feedback. ILog is defined by LibLog !:hhttps://github.com/damianh/LibLog as an abstraction over logging frameworks and allows us to support your preferred logging framework A MessagingConfiguration describing how you want to configure Task Queues for the CommandProcessor. We store messages in a IAmAMessageStore for later replay (in case we need to compensate by trying a message again). We send messages to a Task Queue via a IAmAMessageProducer and we want to know how to map the IRequest (Command or Event) to a Message using a IAmAMessageMapper using an IAmAMessageMapperRegistry. You can use the default MessageMapperRegistry to register the association. You need to provide a IAmAMessageMapperFactory so that we can create instances of your IAmAMessageMapper. You need to provide a IAmAMessageMapperFactory when using MessageMapperRegistry so that we can create instances of your mapper. If you don't want to use Task Queues i.e. you are just using a synchronous Command Dispatcher approach, then use the NoTaskQueues method to indicate your intent Finally we need to provide a IRequestContext to provide context to requests handlers in the pipeline that can be used to pass information without using the message that initiated the pipeline. We instantiate this via a user-provided IAmARequestContextFactory. The default approach is use InMemoryRequestContextFactory to provide a RequestContext unless you have a requirement to replace this, such as in testing.
Inheritance: INeedAHandlers, INeedPolicy, INeedLogging, INeedMessaging, INeedARequestContext, IAmACommandProcessorBuilder
Mostrar archivo Open project: iancooper/Paramore Class Usage Examples

Public Methods

Method Description
Build ( ) : CommandProcessor

Builds the CommandProcessor from the configuration.

DefaultPolicy ( ) : INeedMessaging

Use this if you do not require a policy and only want to retry once(i.e. No Tasks Queues or QoS needs).

Handlers ( HandlerConfiguration handlerConfiguration ) : INeedPolicy

Supplies the specified handler configuration, so that we can register subscribers and the handler factory used to create instances of them

NoTaskQueues ( ) : INeedARequestContext

Use to indicate that you are not using Task Queues.

Policies ( IAmAPolicyRegistry thePolicyRegistry ) : INeedMessaging

Supplies the specified the policy registry, so we can use policies for Task Queues or in user-defined request handlers such as ExceptionHandler that provide quality of service concerns

RequestContextFactory ( IAmARequestContextFactory requestContextFactory ) : IAmACommandProcessorBuilder

The factory for IRequestContext used within the pipeline to pass information between IHandleRequests{T} steps. If you do not need to override provide InMemoryRequestContextFactory.

TaskQueues ( MessagingConfiguration configuration ) : INeedARequestContext

The CommandProcessor wants to support CommandProcessor.Post{T}(T) or CommandProcessor.Repost using Task Queues. You need to provide a policy to specify how QoS issues, specifically CommandProcessor.RETRYPOLICY or CommandProcessor.CIRCUITBREAKER are handled by adding appropriate Policies when choosing this option.

With ( ) : INeedAHandlers

Begins the Fluent Interface

Private Methods

Method Description
CommandProcessorBuilder ( ) : System

Method Details

Build() public method

Builds the CommandProcessor from the configuration.
public Build ( ) : CommandProcessor
return CommandProcessor

DefaultPolicy() public method

Use this if you do not require a policy and only want to retry once(i.e. No Tasks Queues or QoS needs).
public DefaultPolicy ( ) : INeedMessaging
return INeedMessaging

Handlers() public method

Supplies the specified handler configuration, so that we can register subscribers and the handler factory used to create instances of them
public Handlers ( HandlerConfiguration handlerConfiguration ) : INeedPolicy
handlerConfiguration HandlerConfiguration The handler configuration.
return INeedPolicy

NoTaskQueues() public method

Use to indicate that you are not using Task Queues.
public NoTaskQueues ( ) : INeedARequestContext
return INeedARequestContext

Policies() public method

Supplies the specified the policy registry, so we can use policies for Task Queues or in user-defined request handlers such as ExceptionHandler that provide quality of service concerns
The policy registry is missing the CommandProcessor.RETRYPOLICY policy which is required The policy registry is missing the CommandProcessor.CIRCUITBREAKER policy which is required
public Policies ( IAmAPolicyRegistry thePolicyRegistry ) : INeedMessaging
thePolicyRegistry IAmAPolicyRegistry The policy registry.
return INeedMessaging

RequestContextFactory() public method

The factory for IRequestContext used within the pipeline to pass information between IHandleRequests{T} steps. If you do not need to override provide InMemoryRequestContextFactory.
public RequestContextFactory ( IAmARequestContextFactory requestContextFactory ) : IAmACommandProcessorBuilder
requestContextFactory IAmARequestContextFactory The request context factory.
return IAmACommandProcessorBuilder

TaskQueues() public method

The CommandProcessor wants to support CommandProcessor.Post{T}(T) or CommandProcessor.Repost using Task Queues. You need to provide a policy to specify how QoS issues, specifically CommandProcessor.RETRYPOLICY or CommandProcessor.CIRCUITBREAKER are handled by adding appropriate Policies when choosing this option.
public TaskQueues ( MessagingConfiguration configuration ) : INeedARequestContext
configuration MessagingConfiguration The Task Queues configuration.
return INeedARequestContext

With() public static method

Begins the Fluent Interface
public static With ( ) : INeedAHandlers
return INeedAHandlers