示例#1
0
 /// <summary>
 /// Constructs the step, using the given transport and settings
 /// </summary>
 public SimpleRetryStrategyStep(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IRebusLoggerFactory rebusLoggerFactory)
 {
     _transport = transport;
     _simpleRetryStrategySettings = simpleRetryStrategySettings;
     _errorTracker = errorTracker;
     _log = rebusLoggerFactory.GetCurrentClassLogger();
 }
示例#2
0
 /// <summary>
 /// Constructs the step, using the given error tracker
 /// </summary>
 public FailFastStep(IErrorTracker errorTracker, IFailFastChecker failFastChecker, IErrorHandler errorHandler, ITransport transport)
 {
     _errorTracker    = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _failFastChecker = failFastChecker ?? throw new ArgumentNullException(nameof(failFastChecker));
     _errorHandler    = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
     _transport       = transport ?? throw new ArgumentNullException(nameof(transport));
 }
示例#3
0
文件: Worker.cs 项目: rasmuskl/Rebus
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages)
        {
            this.receiveMessages        = receiveMessages;
            this.serializeMessages      = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.errorTracker           = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
 /// <summary>
 /// Constructs the step, using the given transport and settings
 /// </summary>
 public SimpleRetryStrategyStep(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IRebusLoggerFactory rebusLoggerFactory)
 {
     _transport = transport;
     _simpleRetryStrategySettings = simpleRetryStrategySettings;
     _errorTracker = errorTracker;
     _log          = rebusLoggerFactory.GetCurrentClassLogger();
 }
示例#5
0
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages,
                      IStoreTimeouts storeTimeouts,
                      IEnumerable <IUnitOfWorkManager> unitOfWorkManagers,
                      ConfigureAdditionalBehavior configureAdditionalBehavior,
                      MessageLogger messageLogger)
        {
            this.receiveMessages             = receiveMessages;
            this.serializeMessages           = serializeMessages;
            this.mutateIncomingMessages      = mutateIncomingMessages;
            this.unitOfWorkManagers          = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger               = messageLogger;
            this.errorTracker                = errorTracker;
            dispatcher                       = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage  += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
示例#6
0
 /// <summary>
 /// Constructs the step, using the given transport and settings
 /// </summary>
 public SimpleRetryStrategyStep(SimpleRetryStrategySettings simpleRetryStrategySettings, IRebusLoggerFactory rebusLoggerFactory, IErrorTracker errorTracker, IErrorHandler errorHandler, CancellationToken cancellationToken)
 {
     _simpleRetryStrategySettings = simpleRetryStrategySettings ?? throw new ArgumentNullException(nameof(simpleRetryStrategySettings));
     _errorTracker      = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _errorHandler      = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
     _logger            = rebusLoggerFactory?.GetLogger <SimpleRetryStrategyStep>() ?? throw new ArgumentNullException(nameof(rebusLoggerFactory));
     _cancellationToken = cancellationToken;
 }
示例#7
0
 public RetryStrategy(RetryStrategySettings retryStrategySettings,
                      IErrorTracker errorTracker,
                      IErrorHandler errorHandler)
 {
     _retryStrategySettings = retryStrategySettings ?? throw new ArgumentNullException(nameof(retryStrategySettings));
     _errorTrackert         = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _errorHandlert         = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
 }
示例#8
0
 /// <summary>
 /// Constructs the retry strategy with the given settings, creating an error queue with the configured name if necessary
 /// </summary>
 public ArkRetryStrategy(SimpleRetryStrategySettings simpleRetryStrategySettings, IRebusLoggerFactory rebusLoggerFactory, IErrorTracker errorTracker, IErrorHandler errorHandler, IFailFastChecker failFastChecker, CancellationToken cancellationToken)
 {
     _simpleRetryStrategySettings = simpleRetryStrategySettings ?? throw new ArgumentNullException(nameof(simpleRetryStrategySettings));
     _rebusLoggerFactory          = rebusLoggerFactory ?? throw new ArgumentNullException(nameof(rebusLoggerFactory));
     _errorTracker      = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _errorHandler      = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
     _failFastChecker   = failFastChecker;
     _cancellationToken = cancellationToken;
 }
示例#9
0
        /// <summary>
        /// Constructs the retry strategy with the given settings, creating an error queue with the configured name if necessary
        /// </summary>
        public SimpleRetryStrategy(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker)
        {
            _transport = transport;
            _simpleRetryStrategySettings = simpleRetryStrategySettings;
            _errorTracker = errorTracker;

            var errorQueueAddress = _simpleRetryStrategySettings.ErrorQueueAddress;
            
            _transport.CreateQueue(errorQueueAddress);
        }
示例#10
0
        /// <summary>
        /// Constructs the step, using the given transport and settings
        /// </summary>
        public SimpleRetryStrategyStep(SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IErrorHandler errorHandler)
        {
            if (simpleRetryStrategySettings == null) throw new ArgumentNullException(nameof(simpleRetryStrategySettings));
            if (errorTracker == null) throw new ArgumentNullException(nameof(errorTracker));
            if (errorHandler == null) throw new ArgumentNullException(nameof(errorHandler));

            _simpleRetryStrategySettings = simpleRetryStrategySettings;
            _errorTracker = errorTracker;
            _errorHandler = errorHandler;
        }
示例#11
0
        /// <summary>
        /// Constructs the retry strategy with the given settings, creating an error queue with the configured name if necessary
        /// </summary>
        public SimpleRetryStrategy(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IRebusLoggerFactory rebusLoggerFactory)
        {
            _transport = transport;
            _simpleRetryStrategySettings = simpleRetryStrategySettings;
            _errorTracker       = errorTracker;
            _rebusLoggerFactory = rebusLoggerFactory;

            var errorQueueAddress = _simpleRetryStrategySettings.ErrorQueueAddress;

            _transport.CreateQueue(errorQueueAddress);
        }
示例#12
0
        /// <summary>
        /// Constructs the retry strategy with the given settings, creating an error queue with the configured name if necessary
        /// </summary>
        public SimpleRetryStrategy(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IRebusLoggerFactory rebusLoggerFactory)
        {
            _transport = transport;
            _simpleRetryStrategySettings = simpleRetryStrategySettings;
            _errorTracker = errorTracker;
            _rebusLoggerFactory = rebusLoggerFactory;

            var errorQueueAddress = _simpleRetryStrategySettings.ErrorQueueAddress;
            
            _transport.CreateQueue(errorQueueAddress);
        }
示例#13
0
 protected Worker CreateWorker(IReceiveMessages receiveMessages, IActivateHandlers activateHandlers, 
     IInspectHandlerPipeline inspectHandlerPipeline = null,
     IEnumerable<IUnitOfWorkManager> unitOfWorkManagers = null,
     IErrorTracker errorTracker = null)
 {
     return new Worker(errorTracker ??  new ErrorTracker("error"),
                       receiveMessages,
                       activateHandlers,
                       new InMemorySubscriptionStorage(),
                       new JsonMessageSerializer(),
                       new SagaDataPersisterForTesting(),
                       inspectHandlerPipeline ?? new TrivialPipelineInspector(),
                       "Just some test worker",
                       new DeferredMessageHandlerForTesting(),
                       new IncomingMessageMutatorPipelineForTesting(),
                       null,
                       unitOfWorkManagers ?? new IUnitOfWorkManager[0],
                       new ConfigureAdditionalBehavior());
 }
示例#14
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker)
        {
            this.activateHandlers       = activateHandlers;
            this.sendMessages           = sendMessages;
            this.receiveMessages        = receiveMessages;
            this.storeSubscriptions     = storeSubscriptions;
            this.determineDestination   = determineDestination;
            this.serializeMessages      = serializeMessages;
            this.storeSagaData          = storeSagaData;
            this.inspectHandlerPipeline = inspectHandlerPipeline;
            this.errorTracker           = errorTracker;

            batch   = new RebusBatchOperations(determineDestination, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId = Interlocked.Increment(ref rebusIdCounter);

            log.Info("Rebus bus created");
        }
示例#15
0
 protected Worker CreateWorker(IReceiveMessages receiveMessages, IActivateHandlers activateHandlers,
                               IInspectHandlerPipeline inspectHandlerPipeline      = null,
                               IEnumerable <IUnitOfWorkManager> unitOfWorkManagers = null,
                               IErrorTracker errorTracker = null)
 {
     return(new Worker(errorTracker ?? new ErrorTracker("error"),
                       receiveMessages,
                       activateHandlers,
                       new InMemorySubscriptionStorage(),
                       new JsonMessageSerializer(),
                       new SagaDataPersisterForTesting(),
                       inspectHandlerPipeline ?? new TrivialPipelineInspector(),
                       "Just some test worker",
                       new DeferredMessageHandlerForTesting(),
                       new IncomingMessageMutatorPipelineForTesting(),
                       null,
                       unitOfWorkManagers ?? new IUnitOfWorkManager[0],
                       new ConfigureAdditionalBehavior()));
 }
示例#16
0
        /// <summary>
        /// Constructs the step, using the given transport and settings
        /// </summary>
        public SimpleRetryStrategyStep(SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IErrorHandler errorHandler)
        {
            if (simpleRetryStrategySettings == null)
            {
                throw new ArgumentNullException(nameof(simpleRetryStrategySettings));
            }
            if (errorTracker == null)
            {
                throw new ArgumentNullException(nameof(errorTracker));
            }
            if (errorHandler == null)
            {
                throw new ArgumentNullException(nameof(errorHandler));
            }

            _simpleRetryStrategySettings = simpleRetryStrategySettings;
            _errorTracker = errorTracker;
            _errorHandler = errorHandler;
        }
示例#17
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineMessageOwnership">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        /// <param name="storeTimeouts">Optionally provides an internal timeout manager to be used instead of sending timeout requests to an external timeout manager</param>
        /// <param name="configureAdditionalBehavior"></param>
        public RebusBus(
            IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData,
            IDetermineMessageOwnership determineMessageOwnership, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker,
            IStoreTimeouts storeTimeouts, ConfigureAdditionalBehavior configureAdditionalBehavior)
        {
            this.activateHandlers            = activateHandlers;
            this.sendMessages                = sendMessages;
            this.receiveMessages             = receiveMessages;
            this.storeSubscriptions          = storeSubscriptions;
            this.determineMessageOwnership   = determineMessageOwnership;
            this.serializeMessages           = serializeMessages;
            this.storeSagaData               = storeSagaData;
            this.inspectHandlerPipeline      = inspectHandlerPipeline;
            this.errorTracker                = errorTracker;
            this.storeTimeouts               = storeTimeouts;
            this.configureAdditionalBehavior = configureAdditionalBehavior;

            batch   = new RebusBatchOperations(determineMessageOwnership, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId       = Interlocked.Increment(ref rebusIdCounter);
            continuations = new RebusSynchronizationContext();

            log.Info("Rebus bus {0} created", rebusId);

            if (storeTimeouts == null)
            {
                var timeoutManagerEndpointAddress = RebusConfigurationSection
                                                    .GetConfigurationValueOrDefault(s => s.TimeoutManagerAddress, "rebus.timeout");

                log.Info("Using external timeout manager with input queue '{0}'", timeoutManagerEndpointAddress);
                timeoutManagerAddress = timeoutManagerEndpointAddress;
            }
            else
            {
                log.Info("Using internal timeout manager");
                timeoutManagerAddress = this.receiveMessages.InputQueueAddress;
                dueTimeoutScheduler   = new DueTimeoutScheduler(storeTimeouts, new DeferredMessageReDispatcher(this));
            }
        }
 public CircuitBreakerErrorTracker(IErrorTracker innerErrorTracker, MainCircuitBreaker circuitBreaker)
 {
     _innerErrorTracker = innerErrorTracker;
     _circuitBreaker    = circuitBreaker;
 }
 public FailedMessageWrapperStep(IErrorTracker errorTracker) => _errorTracker = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
示例#20
0
文件: Worker.cs 项目: pruiz/Rebus
        public Worker(
            IErrorTracker errorTracker,
            IReceiveMessages receiveMessages,
            IActivateHandlers activateHandlers,
            IStoreSubscriptions storeSubscriptions,
            ISerializeMessages serializeMessages,
            IStoreSagaData storeSagaData,
            IInspectHandlerPipeline inspectHandlerPipeline,
            string workerThreadName,
            IHandleDeferredMessage handleDeferredMessage,
            IMutateIncomingMessages mutateIncomingMessages,
            IStoreTimeouts storeTimeouts,
            IEnumerable<IUnitOfWorkManager> unitOfWorkManagers,
            ConfigureAdditionalBehavior configureAdditionalBehavior,
            MessageLogger messageLogger,
            RebusSynchronizationContext continuations)
        {
            this.receiveMessages = receiveMessages;
            this.serializeMessages = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.unitOfWorkManagers = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger = messageLogger;
            this.continuations = continuations;
            this.errorTracker = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop) { Name = workerThreadName };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
示例#21
0
 public ExposeErrorTrackerStep(IErrorTracker errorTracker) => _errorTracker = errorTracker;
示例#22
0
 /// <summary>
 /// Constructs the retry strategy with the given settings, creating an error queue with the configured name if necessary
 /// </summary>
 public SimpleRetryStrategy(SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker, IErrorHandler errorHandler)
 {
     _simpleRetryStrategySettings = simpleRetryStrategySettings ?? throw new ArgumentNullException(nameof(simpleRetryStrategySettings));
     _errorTracker = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _errorHandler = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler));
 }
 /// <summary>
 /// Uses the specified implementation of <see cref="IErrorTracker"/> to track messages between
 /// failed deliveries
 /// </summary>
 public void UseErrorTracker(IErrorTracker errorTracker)
 {
     Backbone.ErrorTracker = errorTracker;
 }
示例#24
0
 public SecondLevelDispatcher(IErrorTracker errorTracker)
 {
     _errorTracker = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
 }
示例#25
0
 public FailedMessageWrapperStep(IErrorTracker errorTracker)
 {
     _errorTracker = errorTracker;
 }
示例#26
0
 /// <summary>
 /// Constructs the step, using the given error tracker
 /// </summary>
 public FailFastStep(IErrorTracker errorTracker, IFailFastChecker failFastChecker)
 {
     _errorTracker    = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _failFastChecker = failFastChecker ?? throw new ArgumentNullException(nameof(failFastChecker));
 }
示例#27
0
 public CompleteCommandEventStep(IErrorTracker errorTracker, IServiceProvider serviceProvider)
 {
     _errorTracker    = errorTracker;
     _serviceProvider = serviceProvider;
 }
 /// <summary>
 /// Uses the specified implementation of <see cref="IErrorTracker"/> to track messages between
 /// failed deliveries
 /// </summary>
 public void UseErrorTracker(IErrorTracker errorTracker)
 {
     Backbone.ErrorTracker = errorTracker;
 }
示例#29
0
 /// <summary>
 /// Constructs the step, using the given transport and settings
 /// </summary>
 public SimpleRetryStrategyStep(ITransport transport, SimpleRetryStrategySettings simpleRetryStrategySettings, IErrorTracker errorTracker)
 {
     _transport = transport;
     _simpleRetryStrategySettings = simpleRetryStrategySettings;
     _errorTracker = errorTracker;
 }
示例#30
0
 public AddRetryInfoHeaderStep(IErrorTracker errorTracker, string key)
 {
     _errorTracker = errorTracker ?? throw new ArgumentNullException(nameof(errorTracker));
     _key          = key ?? throw new ArgumentNullException(nameof(key));
 }