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); }
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(); }
void Initialize(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages) { this.storeTimeouts = storeTimeouts; rebusBus = new RebusBus(this, sendMessages, receiveMessages, null, null, null, new JsonMessageSerializer(), new TrivialPipelineInspector(), new ErrorTracker(receiveMessages.InputQueueAddress + ".error")); bus = rebusBus; timer.Interval = 300; timer.Elapsed += CheckCallbacks; }
void Initialize(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages, string errorQueueName) { var errorQueuePath = MsmqUtil.GetPath(errorQueueName); MsmqUtil.EnsureMessageQueueExists(errorQueuePath); MsmqUtil.EnsureMessageQueueIsTransactional(errorQueuePath); rebusBus = new RebusBus(this, sendMessages, receiveMessages, null, null, null, new JsonMessageSerializer(), new TrivialPipelineInspector(), new ErrorTracker(errorQueueName), storeTimeouts, new ConfigureAdditionalBehavior()); }
/// <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); }
public IBus CreateBus(string inputQueueName, IActivateHandlers handlerActivator, IStoreTimeouts storeTimeouts) { var transport = CreateTransport(inputQueueName); var bus = new RebusBus(handlerActivator, transport, transport, new InMemorySubscriptionStorage(), new InMemorySagaPersister(), new ThrowingEndpointMapper(), new JsonMessageSerializer(), new TrivialPipelineInspector(), new ErrorTracker(ErrorQueueName), storeTimeouts, new ConfigureAdditionalBehavior()); startables.Add(bus); disposables.Add(bus); return bus; }
/// <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)); } }
/// <summary> /// Installs the given implementation of <see cref="IStoreTimeouts"/> /// </summary> public void Use(IStoreTimeouts storeTimeouts) { Backbone.StoreTimeouts = storeTimeouts; }
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); }
protected override void DoSetUp() { factory = Activator.CreateInstance <TFactory>(); storage = factory.CreateStore(); }
public TimeoutService(IStoreTimeouts storeTimeouts) { var msmqMessageQueue = new MsmqMessageQueue(DefaultInputQueueName); Initialize(storeTimeouts, msmqMessageQueue, msmqMessageQueue, DefaultErrorQueueName); }
public IBus CreateBus(string inputQueueName, IActivateHandlers handlerActivator, IStoreTimeouts storeTimeouts) { var transport = CreateTransport(inputQueueName); var bus = new RebusBus(handlerActivator, transport, transport, new InMemorySubscriptionStorage(), new InMemorySagaPersister(), new ThrowingEndpointMapper(), new JsonMessageSerializer(), new TrivialPipelineInspector(), new ErrorTracker(ErrorQueueName), storeTimeouts, new ConfigureAdditionalBehavior()); startables.Add(bus); disposables.Add(bus); return(bus); }
public TimeoutService(IStoreTimeouts storeTimeouts, string inputQueueName, string errorQueueName) { var msmqMessageQueue = new MsmqMessageQueue(inputQueueName); Initialize(storeTimeouts, msmqMessageQueue, msmqMessageQueue, errorQueueName); }
public TimeoutRequestHandler(IStoreTimeouts storeTimeouts) { this.storeTimeouts = storeTimeouts; }
public TimeoutService(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages) { Initialize(storeTimeouts, sendMessages, receiveMessages, DefaultErrorQueueName); }
public TimeoutService(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages) { Initialize(storeTimeouts, sendMessages, receiveMessages); }
public DualSagaTimeoutStorage(IStoreTimeouts oldTimeoutStorage, IStoreTimeouts newTimeoutStorage) { _oldTimeoutStorage = oldTimeoutStorage; _newTimeoutStorage = newTimeoutStorage; }