Ejemplo n.º 1
0
 protected override void DoSetUp()
 {
     activateHandlers = new HandlerActivatorForTesting();
     determineMessageOwnership = Mock<IDetermineMessageOwnership>();
     sendMessages = Mock<ISendMessages>();
     serializeMessages = new JsonMessageSerializer();
     storeSagaData = Mock<IStoreSagaData>();
     receiveMessages = new MessageReceiverForTesting(serializeMessages);
     inspectHandlerPipeline = new TrivialPipelineInspector();
     storeSubscriptions = Mock<IStoreSubscriptions>();
     bus = CreateTheBus();
     bus.Start();
 }
Ejemplo n.º 2
0
 protected override void DoSetUp()
 {
     activateHandlers          = new HandlerActivatorForTesting();
     determineMessageOwnership = Mock <IDetermineMessageOwnership>();
     sendMessages           = Mock <ISendMessages>();
     serializeMessages      = new JsonMessageSerializer();
     storeSagaData          = Mock <IStoreSagaData>();
     receiveMessages        = new MessageReceiverForTesting(serializeMessages);
     inspectHandlerPipeline = new TrivialPipelineInspector();
     storeSubscriptions     = Mock <IStoreSubscriptions>();
     bus = CreateTheBus();
     bus.Start();
 }
Ejemplo n.º 3
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));
            }
        }
Ejemplo n.º 4
0
 public RebusBatchOperations(IDetermineMessageOwnership determineMessageOwnership, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineMessageOwnership = determineMessageOwnership;
     this.storeSubscriptions = storeSubscriptions;
     this.bus = bus;
 }
Ejemplo n.º 5
0
 public RebusBatchOperations(IDetermineMessageOwnership determineMessageOwnership, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineMessageOwnership = determineMessageOwnership;
     this.storeSubscriptions        = storeSubscriptions;
     this.bus = bus;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Uses the specified implementation of <see cref="IDetermineMessageOwnership"/> to determine who owns messages
 /// </summary>
 public void Use(IDetermineMessageOwnership determineMessageOwnership)
 {
     Backbone.DetermineMessageOwnership = determineMessageOwnership;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Uses the specified implementation of <see cref="IDetermineMessageOwnership"/> to determine who owns messages
 /// </summary>
 public void Use(IDetermineMessageOwnership determineMessageOwnership)
 {
     Backbone.DetermineMessageOwnership = determineMessageOwnership;
 }