BuiltinContainerAdapter GetBus(string inputQueueName, bool encryption, bool compression) { var adapter = TrackDisposable(new BuiltinContainerAdapter()); MsmqUtil.PurgeQueue(inputQueueName); Configure.With(adapter) .Logging(l => l.ColoredConsole(LogLevel.Warn)) .Transport(t => t.UseMsmq(inputQueueName, ErrorQueueName)) .MessageOwnership(o => o.Use(this)) .Decorators(d => { // make this the first decoration step and thus the innermost decorator d.AddDecoration(b => b.SendMessages = new TellTaleSender(b.SendMessages)); if (encryption) { d.EncryptMessageBodies("NLEJVjDYnKfxEUAl2gxflFJfixHwh94iWDltaoayjTM="); } if (compression) { d.CompressMessageBodies(0); } }) .CreateBus() .Start(); return(adapter); }
IBus StartBus(int numberOfWorkers, List <string> log = null, int?numberOfRetries = null) { MsmqUtil.PurgeQueue(InputQueue); MsmqUtil.PurgeQueue(ErrorQueue); return(Configure.With(adapter) .Logging(l => { if (log == null) { l.ColoredConsole(minLevel: LogLevel.Warn); } else { l.Use(new ListLoggerFactory(log)); } }) .Behavior(b => { if (numberOfRetries != null) { b.SetMaxRetriesFor <Exception>(numberOfRetries.Value); } else { b.SetMaxRetriesFor <Exception>(0); } }) .Transport(t => t.UseMsmq(InputQueue, ErrorQueue)) .CreateBus() .Start(numberOfWorkers)); }
public void Initialize(IBusFactory busFactoryToUse) { Console.WriteLine("Purging {0}, just to be sure", TimeoutService.DefaultInputQueueName); MsmqUtil.PurgeQueue(TimeoutService.DefaultInputQueueName); //var sqlServerTimeoutStorage = new SqlServerTimeoutStorage(SqlServerFixtureBase.ConnectionString, "rebus_timeouts").EnsureTableIsCreated(); //var mongoDbTimeoutStorage = new MongoDbTimeoutStorage(MongoDbFixtureBase.ConnectionString, "timeouts"); var inMemoryTimeoutStorage = new InMemoryTimeoutStorage(); timeoutService = new TimeoutService(inMemoryTimeoutStorage); timeoutService.Start(); busFactory = busFactoryToUse; }
protected override void DoSetUp() { adapter = new BuiltinContainerAdapter(); MsmqUtil.PurgeQueue(InputQueueName); Configure.With(adapter) .Transport(t => t.UseMsmq(InputQueueName, "error")) .Behavior(b => b.SetCurrentPrincipalWhenUserNameHeaderIsPresent()) .CreateBus() .Start(); bus = adapter.Bus; }
protected override void DoSetUp() { adapter = TrackDisposable(new BuiltinContainerAdapter()); MsmqUtil.EnsureMessageQueueExists(MsmqUtil.GetPath(AuditQueueName)); MsmqUtil.PurgeQueue(AuditQueueName); MsmqUtil.PurgeQueue(InputQueueName); Configure.With(adapter) .Logging(l => l.ColoredConsole(minLevel: LogLevel.Warn)) .Transport(t => t.UseMsmq(InputQueueName, "error")) .Behavior(b => b.EnableMessageAudit(AuditQueueName)) .CreateBus() .Start(1); }
protected override void DoSetUp() { queuesToReset = new List <string> { LoadBalancerInputQueueName }; try { MsmqUtil.PurgeQueue(LoadBalancerInputQueueName); } catch { } service = new LoadBalancerService(LoadBalancerInputQueueName); TrackDisposable(service); }
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)); EnsureProperDisposal(bus); EnsureProperDisposal(messageQueue); return(bus); }
protected override void SetUp() { _activator = Using(new BuiltinHandlerActivator()); var queueName = TestConfig.GetName("unlucky_continuations"); MsmqUtil.PurgeQueue(queueName); Configure.With(_activator) .Transport(t => t.UseMsmq(queueName)) .Options(o => { o.SetNumberOfWorkers(1); o.SetMaxParallelism(5); }) .Start(); }
protected BuiltinContainerAdapter CreateBus(string inputQueueName, IStoreSubscriptions subscriptionStorage) { MsmqUtil.PurgeQueue(inputQueueName); MsmqUtil.PurgeQueue("error"); var adapter = new BuiltinContainerAdapter(); EnsureProperDisposal(adapter); Configure.With(adapter) .Transport(t => t.UseMsmq(inputQueueName, "error")) .MessageOwnership(o => o.Use(this)) .CreateBus() .Start(1); return(adapter); }
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:" + TestCategories.AvailableHttpPort, }; // and the inbound is on the network domain side orderSystemGatewayService = new GatewayService { ListenUri = "http://+:" + TestCategories.AvailableHttpPort, DestinationQueue = orderSystemInputQueue, }; priceDeskGatewayService.Start(); orderSystemGatewayService.Start(); priceDesk.Start(1); orderSystem.Start(1); }
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:8080", }; // and the inbound is on the network domain side inbound = new GatewayService { ListenUri = "http://+:8080", DestinationQueue = ordersystemInputQueue }; outbound.Start(); inbound.Start(); pricedesk.Start(1); ordersystem.Start(1); }
protected override void SetUp() { MsmqUtil.PurgeQueue(InputQueueName); }
static void PurgeInputQueue(string inputQueueName) { MsmqUtil.PurgeQueue(inputQueueName); }