Beispiel #1
0
 public HandlerFactory(RequestHandlerAttribute attribute, IAmAHandlerFactory factory, IRequestContext requestContext)
 {
     _attribute      = attribute;
     _factory        = factory;
     _requestContext = requestContext;
     _messageType    = typeof(TRequest);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HandlerFactory{TRequest}"/> class.
 /// </summary>
 /// <param name="attribute">The attribute.</param>
 /// <param name="factory">The factory.</param>
 /// <param name="requestContext">The request context.</param>
 public HandlerFactory(RequestHandlerAttribute attribute, IAmAHandlerFactory factory, IRequestContext requestContext)
 {
     this.attribute      = attribute;
     this.factory        = factory;
     this.requestContext = requestContext;
     messageType         = typeof(TRequest);
 }
 /// <summary>
 /// Supplies the specified handler configuration, so that we can register subscribers and the handler factory used to create instances of them
 /// </summary>
 /// <param name="handlerConfiguration">The handler configuration.</param>
 /// <returns>INeedPolicy.</returns>
 public INeedPolicy Handlers(HandlerConfiguration handlerConfiguration)
 {
     _registry            = handlerConfiguration.SubscriberRegistry;
     _handlerFactory      = handlerConfiguration.HandlerFactory;
     _asyncHandlerFactory = handlerConfiguration.AsyncHandlerFactory;
     return(this);
 }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
        /// Use this constructor when both rpc support is required
        /// </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="mapperRegistry">The mapper registry.</param>
        /// <param name="outBox">The outbox</param>
        /// <param name="producerRegistry">The register of producers via whom we send messages over the external bus</param>
        /// <param name="replySubscriptions">The Subscriptions for creating the reply queues</param>
        /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
        /// <param name="outboxTimeout">How long should we wait to write to the outbox</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>
        /// <param name="boxTransactionConnectionProvider">The Box Connection Provider to use when Depositing into the outbox.</param>
        public CommandProcessor(
            IAmASubscriberRegistry subscriberRegistry,
            IAmAHandlerFactory handlerFactory,
            IAmARequestContextFactory requestContextFactory,
            IPolicyRegistry <string> policyRegistry,
            IAmAMessageMapperRegistry mapperRegistry,
            IAmAnOutbox <Message> outBox,
            IAmAProducerRegistry producerRegistry,
            IEnumerable <Subscription> replySubscriptions,
            int outboxTimeout = 300,
            IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
            IAmAChannelFactory responseChannelFactory       = null,
            InboxConfiguration inboxConfiguration           = null,
            IAmABoxTransactionConnectionProvider boxTransactionConnectionProvider = null)
            : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
        {
            _mapperRegistry                   = mapperRegistry;
            _featureSwitchRegistry            = featureSwitchRegistry;
            _responseChannelFactory           = responseChannelFactory;
            _inboxConfiguration               = inboxConfiguration;
            _boxTransactionConnectionProvider = boxTransactionConnectionProvider;
            _replySubscriptions               = replySubscriptions;

            InitExtServiceBus(policyRegistry, outBox, outboxTimeout, producerRegistry);

            ConfigureCallbacks(producerRegistry);
        }
 internal PipelineBuilder(IAmASubscriberRegistry registry, IAmAHandlerFactory handlerFactory, ILog logger)
 {
     this.handlerFactory = handlerFactory;
     this.logger         = logger;
     instanceScope       = new LifetimeScope(handlerFactory);
     interpreter         = new Interpreter <TRequest>(registry, handlerFactory);
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, LogProvider.For <CommandProcessor>())
 {
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, LogProvider.GetCurrentClassLogger())
 {
 }
Beispiel #8
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="handlerFactory">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,
     IAmAHandlerFactory handlerFactory,
     InboxConfiguration inboxConfiguration = null)
 {
     _handlerFactory     = handlerFactory;
     _inboxConfiguration = inboxConfiguration;
     _instanceScope      = new LifetimeScope(handlerFactory);
     _interpreter        = new Interpreter <TRequest>(registry, handlerFactory);
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry)
 {
     _subscriberRegistry    = subscriberRegistry;
     _handlerFactory        = handlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null)
 {
     _subscriberRegistry    = subscriberRegistry;
     _handlerFactory        = handlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _featureSwitchRegistry = featureSwitchRegistry;
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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="logger">The logger.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     ILog logger)
 {
     this.subscriberRegistry    = subscriberRegistry;
     this.handlerFactory        = handlerFactory;
     this.requestContextFactory = requestContextFactory;
     this.policyRegistry        = policyRegistry;
     this.logger = logger;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="messageGatewaySendTimeout">How long should we wait to post to the message store</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout = 300
     )
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, mapperRegistry, messageStore, messageProducer, LogProvider.For <CommandProcessor>(), messageStoreTimeout)
 {
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="messageGatewaySendTimeout">How long should we wait to post to the message store</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout       = 300,
     int messageGatewaySendTimeout = 300
     )
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, mapperRegistry, messageStore, messageProducer, LogProvider.GetCurrentClassLogger())
 {
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required, and you want to inject a test logger
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="asyncHandlerFactory">The async handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="logger">The logger.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     ILog logger)
 {
     _subscriberRegistry    = subscriberRegistry;
     _handlerFactory        = handlerFactory;
     _asyncHandlerFactory   = asyncHandlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _logger = logger;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messagingGateway">The messaging gateway.</param>
 /// <param name="logger">The logger.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messagingGateway,
     ILog logger)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, logger)
 {
     this.mapperRegistry   = mapperRegistry;
     this.messageStore     = messageStore;
     this.messagingGateway = messagingGateway;
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout = 300)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry      = mapperRegistry;
     _messageStore        = messageStore;
     _messageProducer     = messageProducer;
     _messageStoreTimeout = messageStoreTimeout;
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required
 /// </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;
     _handlerFactory        = handlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _featureSwitchRegistry = featureSwitchRegistry;
     _inboxConfiguration    = inboxConfiguration;
 }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both rpc and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     IAmAChannelFactory responseChannelFactory       = null)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry         = mapperRegistry;
     _messageProducer        = messageProducer;
     _messageStoreTimeout    = messageStoreTimeout;
     _featureSwitchRegistry  = featureSwitchRegistry;
     _responseChannelFactory = responseChannelFactory;
 }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both rpc and command processor support is required
 /// </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="mapperRegistry">The mapper registry.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
 /// <param name="outboxTimeout">How long should we wait to write to the outbox</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,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageProducer messageProducer,
     int outboxTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     IAmAChannelFactory responseChannelFactory       = null,
     InboxConfiguration inboxConfiguration           = null)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry         = mapperRegistry;
     _messageProducer        = messageProducer;
     _outboxTimeout          = outboxTimeout;
     _featureSwitchRegistry  = featureSwitchRegistry;
     _responseChannelFactory = responseChannelFactory;
     _inboxConfiguration     = inboxConfiguration;
 }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required, and you want to inject a test logger
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="asyncHandlerFactory">The async handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="asyncMessageStore">The message store supporting async/await.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageStoreAsync <Message> asyncMessageStore,
     IAmAMessageProducer messageProducer,
     IAmAMessageProducerAsync asyncMessageProducer,
     int messageStoreTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null)
     : this(subscriberRegistry, handlerFactory, asyncHandlerFactory, requestContextFactory, policyRegistry, featureSwitchRegistry)
 {
     _mapperRegistry       = mapperRegistry;
     _messageStore         = messageStore;
     _asyncMessageStore    = asyncMessageStore;
     _messageProducer      = messageProducer;
     _asyncMessageProducer = asyncMessageProducer;
     _messageStoreTimeout  = messageStoreTimeout;
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required, and you want to inject a test logger
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="asyncHandlerFactory">The async handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="asyncMessageStore">The message store supporting async/await.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="messageGatewaySendTimeout">How long should we wait to post to the message store</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageStoreAsync <Message> asyncMessageStore,
     IAmAMessageProducer messageProducer,
     IAmAMessageProducerAsync asyncMessageProducer,
     ILog logger,
     int messageStoreTimeout       = 300,
     int messageGatewaySendTimeout = 300
     )
     : this(subscriberRegistry, handlerFactory, asyncHandlerFactory, requestContextFactory, policyRegistry, logger)
 {
     _mapperRegistry       = mapperRegistry;
     _messageStore         = messageStore;
     _asyncMessageStore    = asyncMessageStore;
     _messageProducer      = messageProducer;
     _asyncMessageProducer = asyncMessageProducer;
     _messageStoreTimeout  = messageStoreTimeout;
 }
Beispiel #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both task queue and command processor support is required, and you want to inject a test logger
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="asyncHandlerFactory">The async handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="outBox">The outbox.</param>
 /// <param name="asyncOutbox">The outbox supporting async/await.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param>
 /// <param name="outboxTimeout">How long should we wait to write to the outbox</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,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IPolicyRegistry <string> policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAnOutbox <Message> outBox,
     IAmAnOutboxAsync <Message> asyncOutbox,
     IAmAMessageProducer messageProducer,
     IAmAMessageProducerAsync asyncMessageProducer,
     int outboxTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     InboxConfiguration inboxConfiguration           = null)
     : this(subscriberRegistry, handlerFactory, asyncHandlerFactory, requestContextFactory, policyRegistry, featureSwitchRegistry)
 {
     _mapperRegistry       = mapperRegistry;
     _outBox               = outBox;
     _asyncOutbox          = asyncOutbox;
     _messageProducer      = messageProducer;
     _asyncMessageProducer = asyncMessageProducer;
     _outboxTimeout        = outboxTimeout;
     _inboxConfiguration   = inboxConfiguration;
 }
Beispiel #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HandlerConfiguration"/> class.
 /// We use the <see cref="IAmASubscriberRegistry"/> instance to look up subscribers for messages when dispatching. Use <see cref="SubscriberRegistry"/> unless
 /// you have some reason to override. We expect a <see cref="CommandProcessor.Send{T}(T)"/> to have one registered handler
 /// We use the
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 public HandlerConfiguration(IAmASubscriberRegistry subscriberRegistry, IAmAHandlerFactory handlerFactory)
 {
     SubscriberRegistry = subscriberRegistry;
     HandlerFactory     = handlerFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HandlerConfiguration"/> class.
 /// We use the <see cref="IAmASubscriberRegistry"/> instance to look up subscribers for messages when dispatching. Use <see cref="SubscriberRegistry"/> unless
 /// you have some reason to override. We expect a <see cref="CommandProcessor.Send{T}(T)"/> to have one registered handler
 /// We use the 
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="asyncHandlerFactory">The async handler factory.</param>
 public HandlerConfiguration(IAmASubscriberRegistry subscriberRegistry, IAmAHandlerFactory handlerFactory, IAmAnAsyncHandlerFactory asyncHandlerFactory)
 {
     SubscriberRegistry = subscriberRegistry;
     HandlerFactory = handlerFactory;
     AsyncHandlerFactory = asyncHandlerFactory;
 }
Beispiel #25
0
 internal PipelineBuilder(IAmASubscriberRegistry registry, IAmAHandlerFactory handlerFactory)
     : this(registry, handlerFactory, LogProvider.GetCurrentClassLogger())
 {
 }
Beispiel #26
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, ILog logger = null)
 {
     _handlerFactory = handlerFactory;
     _logger = logger;
 }
Beispiel #27
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAnAsyncHandlerFactory asyncHandlerFactory) 
     :this(handlerFactory, asyncHandlerFactory, LogProvider.GetCurrentClassLogger())
 {}
Beispiel #28
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory) 
     :this(handlerFactory, null, LogProvider.GetCurrentClassLogger())
 {}
Beispiel #29
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory)
     : this(handlerFactory, null)
 {
 }
Beispiel #30
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAHandlerFactoryAsync asyncHandlerFactory, ILog logger)
 {
     _handlerFactory      = handlerFactory;
     _asyncHandlerFactory = asyncHandlerFactory;
     _logger = logger;
 }
Beispiel #31
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAHandlerFactoryAsync asyncHandlerFactory) 
 {
     _handlerFactory = handlerFactory;
     _asyncHandlerFactory = asyncHandlerFactory;
 }
Beispiel #32
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory) 
     : this(handlerFactory, null)
 {}
 /// <summary>
 /// Supplies the specified handler configuration, so that we can register subscribers and the handler factory used to create instances of them
 /// </summary>
 /// <param name="handlerConfiguration">The handler configuration.</param>
 /// <returns>INeedPolicy.</returns>
 public INeedPolicy Handlers(HandlerConfiguration handlerConfiguration)
 {
     _registry = handlerConfiguration.SubscriberRegistry;
     _handlerFactory = handlerConfiguration.HandlerFactory;
     return this;
 }
Beispiel #34
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAnAsyncHandlerFactory asyncHandlerFactory, ILog logger)
 {
     _handlerFactory = handlerFactory;
     _asyncHandlerFactory = asyncHandlerFactory;
     _logger = logger;
 }
Beispiel #35
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory)
     : this(handlerFactory, LogProvider.GetCurrentClassLogger())
 {
 }
Beispiel #36
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory)
     : this(handlerFactory, null, LogProvider.For <LifetimeScope>())
 {
 }
Beispiel #37
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAHandlerFactoryAsync asyncHandlerFactory)
     : this(handlerFactory, asyncHandlerFactory, LogProvider.For <LifetimeScope>())
 {
 }
Beispiel #38
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, ILog logger = null)
 {
     this.handlerFactory = handlerFactory;
     this.logger = logger;
 }
Beispiel #39
0
 public LifetimeScope(IAmAHandlerFactory handlerFactory, IAmAHandlerFactoryAsync asyncHandlerFactory)
 {
     _handlerFactory      = handlerFactory;
     _asyncHandlerFactory = asyncHandlerFactory;
 }