Example #1
0
 public HandlerFactory(RequestHandlerAttribute attribute, IAmAHandlerFactorySync factorySync, IRequestContext requestContext)
 {
     _attribute      = attribute;
     _factorySync    = factorySync;
     _requestContext = requestContext;
     _messageType    = typeof(TRequest);
 }
Example #2
0
 /// <summary>
 /// Used to build a pipeline of handlers from the target handler and the attributes on that
 /// target handler which represent other filter steps in the pipeline
 /// </summary>
 /// <param name="registry">What handler services this request</param>
 /// <param name="handlerFactorySync">Callback to the user code to create instances of handlers</param>
 /// <param name="inboxConfiguration">Do we have a global attribute to add an inbox</param>
 public PipelineBuilder(
     IAmASubscriberRegistry registry,
     IAmAHandlerFactorySync handlerFactorySync,
     InboxConfiguration inboxConfiguration = null)
 {
     _handlerFactorySync = handlerFactorySync;
     _inboxConfiguration = inboxConfiguration;
     _instanceScope      = new LifetimeScope(handlerFactorySync);
     _interpreter        = new Interpreter <TRequest>(registry, handlerFactorySync);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no external bus is required and only sync handlers are needed
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
 /// <param name="inboxConfiguration">Do we want to insert an inbox handler into pipelines without the attribute. Null (default = no), yes = how to configure</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IPolicyRegistry <string> policyRegistry,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     InboxConfiguration inboxConfiguration           = null
     )
 {
     _subscriberRegistry = subscriberRegistry;
     if (handlerFactory is IAmAHandlerFactorySync handlerFactorySync)
     {
         _handlerFactorySync = handlerFactorySync;
     }
     if (handlerFactory is IAmAHandlerFactoryAsync handlerFactoryAsync)
     {
         _handlerFactoryAsync = handlerFactoryAsync;
     }
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _featureSwitchRegistry = featureSwitchRegistry;
     _inboxConfiguration    = inboxConfiguration;
 }
Example #4
0
 internal Interpreter(IAmASubscriberRegistry registry, IAmAHandlerFactorySync handlerFactorySync, IAmAHandlerFactoryAsync asyncHandlerFactory)
 {
     _registry            = registry;
     _handlerFactorySync  = handlerFactorySync;
     _asyncHandlerFactory = asyncHandlerFactory;
 }
Example #5
0
 internal Interpreter(IAmASubscriberRegistry registry, IAmAHandlerFactorySync handlerFactorySync)
     : this(registry, handlerFactorySync, null)
 {
 }
Example #6
0
 public LifetimeScope(IAmAHandlerFactorySync handlerFactorySync, IAmAHandlerFactoryAsync asyncHandlerFactory)
 {
     _handlerFactorySync  = handlerFactorySync;
     _asyncHandlerFactory = asyncHandlerFactory;
 }
Example #7
0
 public LifetimeScope(IAmAHandlerFactorySync handlerFactorySync)
     : this(handlerFactorySync, null)
 {
 }