Beispiel #1
0
        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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
 public DueTimeoutScheduler(IStoreTimeouts storeTimeouts, IHandleDeferredMessage handleDeferredMessage)
 {
     this.storeTimeouts = storeTimeouts;
     this.handleDeferredMessage = handleDeferredMessage;
     timer.Interval = TimeSpan.FromSeconds(0.3).TotalMilliseconds;
     timer.Elapsed += CheckCallbacks;
  
     log.Info("Starting due timeouts scheduler");
     timer.Start();
 }
Beispiel #4
0
        public DueTimeoutScheduler(IStoreTimeouts storeTimeouts, IHandleDeferredMessage handleDeferredMessage)
        {
            this.storeTimeouts         = storeTimeouts;
            this.handleDeferredMessage = handleDeferredMessage;
            timer.Interval             = TimeSpan.FromSeconds(0.3).TotalMilliseconds;
            timer.Elapsed += CheckCallbacks;

            log.Info("Starting due timeouts scheduler");
            timer.Start();
        }
Beispiel #5
0
 /// <summary>
 /// Constructs the dispatcher with the specified instances to store and retrieve saga data,
 /// create message handlers, store and retrieve subscriptions, and to inspect and
 /// possibly rearrange the handler pipeline.
 /// </summary>
 public Dispatcher(IStoreSagaData storeSagaData,
                   IActivateHandlers activateHandlers,
                   IStoreSubscriptions storeSubscriptions,
                   IInspectHandlerPipeline inspectHandlerPipeline,
                   IHandleDeferredMessage handleDeferredMessage)
 {
     this.storeSagaData          = storeSagaData;
     this.activateHandlers       = activateHandlers;
     this.storeSubscriptions     = storeSubscriptions;
     this.inspectHandlerPipeline = inspectHandlerPipeline;
     this.handleDeferredMessage  = handleDeferredMessage;
 }
Beispiel #6
0
 /// <summary>
 /// Constructs the dispatcher with the specified instances to store and retrieve saga data,
 /// create message handlers, store and retrieve subscriptions, and to inspect and
 /// possibly rearrange the handler pipeline.
 /// </summary>
 public Dispatcher(IStoreSagaData storeSagaData,
                   IActivateHandlers activateHandlers,
                   IStoreSubscriptions storeSubscriptions,
                   IInspectHandlerPipeline inspectHandlerPipeline,
                   IHandleDeferredMessage handleDeferredMessage,
                   IStoreTimeouts storeTimeouts)
 {
     this.storeSagaData          = storeSagaData;
     this.activateHandlers       = activateHandlers;
     this.storeSubscriptions     = storeSubscriptions;
     this.inspectHandlerPipeline = inspectHandlerPipeline;
     this.handleDeferredMessage  = handleDeferredMessage;
     this.storeTimeouts          = storeTimeouts;
     sagaDataIdPropertyName      = Reflect.Path <ISagaData>(s => s.Id);
     sagaDataPropertyName        = Reflect.Path <Saga <ISagaData> >(s => s.Data);
 }
Beispiel #7
0
 public TimeoutReplyHandler(IHandleDeferredMessage handleDeferredMessage)
 {
     this.handleDeferredMessage = handleDeferredMessage;
 }
Beispiel #8
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,
            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);
        }