protected override void DoSetUp()
        {
            sender = CreateBus(SenderInputQueueName, new HandlerActivatorForTesting()).Start(1);

            recipientHandlers = new HandlerActivatorForTesting();
            recipient = CreateBus(RecipientInputQueueName, recipientHandlers).Start(1);
        }
 protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers)
 {
     var messageQueue = new MsmqMessageQueue(inputQueueName).PurgeInputQueue();
     serializer = new JsonMessageSerializer();
     var bus = new RebusBus(activateHandlers, messageQueue, messageQueue,
                            new InMemorySubscriptionStorage(), this,
                            serializer, new SagaDataPersisterForTesting(),
                            new TrivialPipelineInspector());
     buses.Add(bus);
     return bus;
 }
Example #3
0
        public IAdvancedBus CreateBus(string inputQueueName, IActivateHandlers handlerActivator)
        {
            var transport = CreateTransport(inputQueueName);

            var bus = new RebusBus(handlerActivator, transport, transport, new InMemorySubscriptionStorage(),
                                   new InMemorySagaPersister(), new ThrowingEndpointMapper(),
                                   new JsonMessageSerializer(),
                                   new TrivialPipelineInspector(), new ErrorTracker("error"));
            startables.Add(bus);

            return bus;
        }
Example #4
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();
 }
Example #5
0
        protected RebusBus CreateBus(string inputQueueName, IActivateHandlers handlerActivator)
        {
            var rabbitMqMessageQueue = new RabbitMqMessageQueue(ConnectionString, inputQueueName, inputQueueName + ".error").PurgeInputQueue();

            var bus = new RebusBus(handlerActivator, rabbitMqMessageQueue, rabbitMqMessageQueue,
                                   new InMemorySubscriptionStorage(), new InMemorySagaPersister(), this,
                                   new JsonMessageSerializer(), new TrivialPipelineInspector());

            toDispose.Add(bus);
            toDispose.Add(rabbitMqMessageQueue);

            return bus;
        }
        protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, string errorQueueName)
        {
            var messageQueue = new MsmqMessageQueue(inputQueueName).PurgeInputQueue();
            MsmqUtil.PurgeQueue(errorQueueName);
            serializer = new JsonMessageSerializer();
            var bus = new RebusBus(activateHandlers, messageQueue, messageQueue,
                                   storeSubscriptions, storeSagaData,
                                   this, serializer, pipelineInspector,
                                   new ErrorTracker(errorQueueName),
                                   null,
                                   new ConfigureAdditionalBehavior());
            
            EnsureProperDisposal(bus);
            EnsureProperDisposal(messageQueue);

            return bus;
        }
Example #7
0
        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 void SubscriptionWorks()
        {
            var inputQueueName = "test.subscriber";
            var messageQueue = new MsmqMessageQueue(inputQueueName).PurgeInputQueue();
            serializer = new JsonMessageSerializer();

            var subscriptionStorage = new InMemorySubscriptionStorage();
            var bus = new RebusBus(new HandlerActivatorForTesting(), messageQueue, messageQueue,
                                   subscriptionStorage, new SagaDataPersisterForTesting(),
                                   this, serializer, new TrivialPipelineInspector());

            bus.Start();
            bus.Subscribe<TheMessage>("test.subscriber");

            Thread.Sleep(500);

            Assert.AreEqual("test.subscriber", subscriptionStorage.GetSubscribers(typeof(TheMessage))[0]);
        }
Example #9
0
 internal ThreadPoolWorker(string name, ITransport transport, IRebusLoggerFactory rebusLoggerFactory, IPipeline pipeline, IPipelineInvoker pipelineInvoker, ParallelOperationsManager parallelOperationsManager, RebusBus owningBus, Options options, ISyncBackoffStrategy backoffStrategy)
 {
     Name = name;
     _log = rebusLoggerFactory.GetCurrentClassLogger();
     _transport = transport;
     _pipeline = pipeline;
     _pipelineInvoker = pipelineInvoker;
     _parallelOperationsManager = parallelOperationsManager;
     _owningBus = owningBus;
     _options = options;
     _backoffStrategy = backoffStrategy;
     _workerThread = new Thread(Run)
     {
         Name = name,
         IsBackground = true
     };
     _workerThread.Start();
 }
        /// <summary>
        /// Creates the bus by using all the configured implementations from the backbone, running configured decoration
        /// steps
        /// </summary>
        public IStartableBus CreateBus()
        {
            VerifyComponents(Backbone);

            FillInDefaults(Backbone);

            Backbone.ApplyDecorators();

            var bus = new RebusBus(Backbone.ActivateHandlers, Backbone.SendMessages, Backbone.ReceiveMessages,
                                   Backbone.StoreSubscriptions, Backbone.StoreSagaData, Backbone.DetermineMessageOwnership,
                                   Backbone.SerializeMessages, Backbone.InspectHandlerPipeline, Backbone.ErrorTracker,
                                   Backbone.StoreTimeouts, Backbone.AdditionalBehavior);

            Backbone.TransferEvents(bus);

            Backbone.FinishConfiguration(bus);

            return bus;
        }
Example #11
0
        protected override void DoSetUp()
        {
            RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Info };

            // this one is in DMZ
            priceDeskInputQueue = "test.pricedesk.input";
            priceDeskHandlerActivator = new HandlerActivatorForTesting();
            priceDesk = CreateBus(priceDeskInputQueue, priceDeskHandlerActivator);

            // and this one is inside
            orderSystemInputQueue = "test.ordersystem.input";
            orderSystemHandlerActivator = new HandlerActivatorForTesting();
            orderSystem = CreateBus(orderSystemInputQueue, orderSystemHandlerActivator);

            priceDeskGatewayInputQueue = "test.rebus.pricedesk.gateway";
            MsmqUtil.PurgeQueue(priceDeskGatewayInputQueue);

            orderSystemGatewayInputQueue = "test.rebus.ordersystem.gateway";
            MsmqUtil.PurgeQueue(orderSystemGatewayInputQueue);

            // so we set up a one-way gateway service on each side:
            // - the outbound is on the DMZ side
            priceDeskGatewayService = new GatewayService
                {
                    ListenQueue = priceDeskGatewayInputQueue,
                    DestinationUri = "http://localhost:8080",
                };

            // and the inbound is on the network domain side
            orderSystemGatewayService = new GatewayService
                {
                    ListenUri = "http://+:8080",
                    DestinationQueue = orderSystemInputQueue,
                };

            priceDeskGatewayService.Start();
            orderSystemGatewayService.Start();

            priceDesk.Start(1);
            orderSystem.Start(1);
        }
Example #12
0
 public AdvancedApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #13
0
 public TransportMessageApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #14
0
 public WorkersApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #15
0
 public TopicsApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
 public RebusBatchOperations(IDetermineMessageOwnership determineMessageOwnership, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineMessageOwnership = determineMessageOwnership;
     this.storeSubscriptions        = storeSubscriptions;
     this.bus = bus;
 }
Example #17
0
 public SyncApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #18
0
        protected override void DoSetUp()
        {
            // this one is in DMZ
            pricedeskInputQueue = "test.pricedesk.input";
            pricedesk = CreateBus(pricedeskInputQueue, new HandlerActivatorForTesting());

            // and this one is inside
            ordersystemInputQueue = "test.ordersystem.input";
            orderSystemHandlerActivator = new HandlerActivatorForTesting();
            ordersystem = CreateBus(ordersystemInputQueue, orderSystemHandlerActivator);

            // so we set up a one-way gateway service on each side:
            gatewayInDmz = new GatewayService
                {
                    ListenQueue = "test.rebus.dmz.gateway",
                    DestinationUri = "http://localhost:18080",
                };
            gatewayInside = new GatewayService
                {
                    ListenUri = "http://+:18080",
                    DestinationQueue = ordersystemInputQueue
                };

            gatewayInDmz.Start();
            gatewayInside.Start();

            pricedesk.Start(1);
            ordersystem.Start(1);
        }
Example #19
0
 public RoutingApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #20
0
 public RebusBatchOperations(IDetermineDestination determineDestination, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineDestination = determineDestination;
     this.storeSubscriptions = storeSubscriptions;
     this.bus = bus;
 }
        protected override void DoSetUp()
        {
            RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Warn };

            MsmqUtil.Delete(PriceDeskInputQueue);
            MsmqUtil.Delete(OrderSystemInputQueue);
            MsmqUtil.Delete(GatewayListeningQueue);

            // this one is in DMZ
            pricedesk = CreateBus(PriceDeskInputQueue, new HandlerActivatorForTesting());

            // and this one is inside
            orderSystemHandlerActivator = new HandlerActivatorForTesting();
            ordersystem = CreateBus(OrderSystemInputQueue, orderSystemHandlerActivator);

            // so we set up a one-way gateway service on each side:
            gatewayInDmz = new GatewayService
                {
                    ListenQueue = GatewayListeningQueue,
                    DestinationUri = "http://localhost:18080",
                };
            gatewayInside = new GatewayService
                {
                    ListenUri = "http://+:18080",
                    DestinationQueue = OrderSystemInputQueue
                };

            gatewayInDmz.Start();
            gatewayInside.Start();

            pricedesk.Start(1);
            ordersystem.Start(1);
        }
Example #22
0
 public AdvancedApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #23
0
 public TopicsApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #24
0
 public WorkersApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #25
0
 public RoutingApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }
Example #26
0
 public RebusBatchOperations(IDetermineMessageOwnership determineMessageOwnership, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineMessageOwnership = determineMessageOwnership;
     this.storeSubscriptions = storeSubscriptions;
     this.bus = bus;
 }
        protected RebusBus CreateBus(string inputQueueName, IActivateHandlers activateHandlers, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, string errorQueueName)
        {
            var messageQueue = new MsmqMessageQueue(inputQueueName, errorQueueName).PurgeInputQueue();
            MsmqUtil.PurgeQueue(errorQueueName);
            serializer = new JsonMessageSerializer();
            var bus = new RebusBus(activateHandlers, messageQueue, messageQueue,
                                   storeSubscriptions, storeSagaData,
                                   this, serializer, pipelineInspector);
            toDispose.Add(bus);
            toDispose.Add(messageQueue);

            return bus;
        }
Example #28
0
 public TransportMessageApi(RebusBus rebusBus) => _rebusBus = rebusBus ?? throw new ArgumentNullException(nameof(rebusBus));
Example #29
0
 public RebusBatchOperations(IDetermineDestination determineDestination, IStoreSubscriptions storeSubscriptions, RebusBus bus)
 {
     this.determineDestination = determineDestination;
     this.storeSubscriptions   = storeSubscriptions;
     this.bus = bus;
 }
Example #30
0
 /// <summary>
 /// Constructs the routing API with the specified <see cref="RebusBus"/>
 /// </summary>
 public RebusRouting(RebusBus rebusBus)
 {
     this.rebusBus = rebusBus;
 }
Example #31
0
        protected override void DoSetUp()
        {
            RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Warn };

            // this one is in DMZ
            pricedeskInputQueue = "test.pricedesk.input";
            pricedesk = CreateBus(pricedeskInputQueue, new HandlerActivatorForTesting());

            // and this one is inside
            ordersystemInputQueue = "test.ordersystem.input";
            orderSystemHandlerActivator = new HandlerActivatorForTesting();
            ordersystem = CreateBus(ordersystemInputQueue, orderSystemHandlerActivator);

            outboundListenQueue = "test.rebus.dmz.gateway";
            MsmqUtil.PurgeQueue(outboundListenQueue);

            // so we set up a one-way gateway service on each side:
            // - the outbound is on the DMZ side
            outbound = new GatewayService
                {
                    ListenQueue = outboundListenQueue,
                    DestinationUri = "http://localhost:" + TestCategories.AvailableHttpPort,
                };

            // and the inbound is on the network domain side
            inbound = new GatewayService
                {
                    ListenUri = "http://+:" + TestCategories.AvailableHttpPort,
                    DestinationQueue = ordersystemInputQueue
                };

            outbound.Start();
            inbound.Start();

            pricedesk.Start(1);
            ordersystem.Start(1);
        }
Example #32
0
 public TransportMessageApi(RebusBus rebusBus)
 {
     _rebusBus = rebusBus;
 }