コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required and only async handlers are used
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</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,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     ILog logger)
 {
     _subscriberRegistry    = subscriberRegistry;
     _asyncHandlerFactory   = asyncHandlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _logger = logger;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when only task queue support is required
 /// </summary>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="asyncMessageStore">The message store supporting async/await.</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>
 public CommandProcessor(
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStoreAsync <Message> asyncMessageStore,
     IAmAMessageProducerAsync asyncMessageProducer,
     int messageStoreTimeout = 300
     )
     : this(
         requestContextFactory, policyRegistry, mapperRegistry, asyncMessageStore, asyncMessageProducer,
         LogProvider.GetCurrentClassLogger(), messageStoreTimeout)
 {
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when no task queue support is required and only async handlers are used
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</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="featureSwitchRegistry">The feature switch config provider.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null)
 {
     _subscriberRegistry    = subscriberRegistry;
     _asyncHandlerFactory   = asyncHandlerFactory;
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _featureSwitchRegistry = featureSwitchRegistry;
 }
コード例 #4
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;
 }
コード例 #5
0
ファイル: CommandProcessor.cs プロジェクト: ritasker/Paramore
 /// <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)
 {
 }
コード例 #6
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())
 {
 }
コード例 #7
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;
 }
コード例 #8
0
        /// <summary>
        /// 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
        /// </summary>
        /// <param name="thePolicyRegistry">The policy registry.</param>
        /// <returns>INeedLogging.</returns>
        /// <exception cref="ConfigurationException">The policy registry is missing the CommandProcessor.RETRYPOLICY policy which is required</exception>
        /// <exception cref="ConfigurationException">The policy registry is missing the CommandProcessor.CIRCUITBREAKER policy which is required</exception>
        public INeedMessaging Policies(IAmAPolicyRegistry thePolicyRegistry)
        {
            if (!thePolicyRegistry.Has(CommandProcessor.RETRYPOLICY))
            {
                throw new ConfigurationException("The policy registry is missing the CommandProcessor.RETRYPOLICY policy which is required");
            }

            if (!thePolicyRegistry.Has(CommandProcessor.CIRCUITBREAKER))
            {
                throw new ConfigurationException("The policy registry is missing the CommandProcessor.CIRCUITBREAKER policy which is required");
            }

            _policyRegistry = thePolicyRegistry;
            return(this);
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when only task queue support is required
 /// </summary>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="asyncMessageStore">The message store supporting async/await.</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>
 public CommandProcessor(
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStoreAsync <Message> asyncMessageStore,
     IAmAMessageProducerAsync asyncMessageProducer,
     int messageStoreTimeout = 300)
 {
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _messageStoreTimeout   = messageStoreTimeout;
     _mapperRegistry        = mapperRegistry;
     _asyncMessageStore     = asyncMessageStore;
     _asyncMessageProducer  = asyncMessageProducer;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when only task queue support is required
 /// </summary>
 /// <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(
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messagingGateway,
     ILog logger)
 {
     this.requestContextFactory = requestContextFactory;
     this.policyRegistry        = policyRegistry;
     this.logger           = logger;
     this.mapperRegistry   = mapperRegistry;
     this.messageStore     = messageStore;
     this.messagingGateway = messagingGateway;
 }
コード例 #11
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="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="asyncMessageStore">The message store supporting async/await.</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>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactoryAsync asyncHandlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStoreAsync <Message> asyncMessageStore,
     IAmAMessageProducerAsync asyncMessageProducer,
     int messageStoreTimeout = 300)
     : this(subscriberRegistry, asyncHandlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry       = mapperRegistry;
     _asyncMessageStore    = asyncMessageStore;
     _asyncMessageProducer = asyncMessageProducer;
     _messageStoreTimeout  = messageStoreTimeout;
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when only task queue support is required
 /// </summary>
 /// <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="featureSwitchRegistry">The feature switch config provider.</param>
 public CommandProcessor(
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null)
 {
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _messageStoreTimeout   = messageStoreTimeout;
     _mapperRegistry        = mapperRegistry;
     _messageStore          = messageStore;
     _messageProducer       = messageProducer;
     _featureSwitchRegistry = featureSwitchRegistry;
 }
コード例 #13
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;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when only task queue support is required, and you wish to inject a test logger
 /// </summary>
 /// <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="logger">The logger.</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 public CommandProcessor(
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     ILog logger,
     int messageStoreTimeout = 300
     )
 {
     _requestContextFactory = requestContextFactory;
     _policyRegistry        = policyRegistry;
     _logger = logger;
     _messageStoreTimeout = messageStoreTimeout;
     _mapperRegistry      = mapperRegistry;
     _messageStore        = messageStore;
     _messageProducer     = messageProducer;
 }
コード例 #15
0
ファイル: CommandProcessor.cs プロジェクト: ritasker/Paramore
 /// <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="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="logger">The logger.</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,
     ILog logger,
     int messageStoreTimeout = 300
     )
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry, logger)
 {
     _mapperRegistry      = mapperRegistry;
     _messageStore        = messageStore;
     _messageProducer     = messageProducer;
     _messageStoreTimeout = messageStoreTimeout;
 }
コード例 #16
0
 /// <summary>
 /// 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
 /// </summary>
 /// <param name="thePolicyRegistry">The policy registry.</param>
 /// <returns>INeedLogging.</returns>
 public INeedLogging Policies(IAmAPolicyRegistry thePolicyRegistry)
 {
     _policyRegistry = thePolicyRegistry;
     return this;
 }
コード例 #17
0
 /// <summary>
 /// Use this if you do not require a policy and only want to retry once(i.e. No Tasks Queues or QoS needs).
 /// </summary>
 /// <returns>INeedLogging.</returns>
 public INeedMessaging DefaultPolicy()
 {
     _policyRegistry = new DefaultPolicy();
     return(this);
 }
コード例 #18
0
 /// <summary>
 /// 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
 /// </summary>
 /// <param name="thePolicyRegistry">The policy registry.</param>
 /// <returns>INeedLogging.</returns>
 public INeedLogging Policies(IAmAPolicyRegistry thePolicyRegistry)
 {
     policyRegistry = thePolicyRegistry;
     return(this);
 }
コード例 #19
0
 /// <summary>
 /// Use this if you do not require a policy and only want to retry once(i.e. No Tasks Queues or QoS needs).
 /// </summary>
 /// <returns>INeedLogging.</returns>
 public INeedLogging DefaultPolicy()
 {
     _policyRegistry = new DefaultPolicy();
     return this;
 }
コード例 #20
0
 /// <summary>
 /// 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
 /// </summary>
 /// <param name="thePolicyRegistry">The policy registry.</param>
 /// <returns>INeedLogging.</returns>
 /// <exception cref="ConfigurationException">The policy registry is missing the CommandProcessor.RETRYPOLICY policy which is required</exception>
 /// <exception cref="ConfigurationException">The policy registry is missing the CommandProcessor.CIRCUITBREAKER policy which is required</exception>
 public INeedLogging Policies(IAmAPolicyRegistry thePolicyRegistry)
 {
     if (!thePolicyRegistry.Has(CommandProcessor.RETRYPOLICY))
         throw new ConfigurationException("The policy registry is missing the CommandProcessor.RETRYPOLICY policy which is required");
         
     if (!thePolicyRegistry.Has(CommandProcessor.CIRCUITBREAKER))
         throw new ConfigurationException("The policy registry is missing the CommandProcessor.CIRCUITBREAKER policy which is required");
     
     _policyRegistry = thePolicyRegistry;
     return this;
 }