public void SetUp() { databusForSiteA = new InMemoryDataBus(); databusForSiteB = new InMemoryDataBus(); inMemoryReceiver = new InMemoryReceiver(); var builder = MockRepository.GenerateStub <IBuilder>(); var channelFactory = new ChannelFactory(); channelFactory.RegisterReceiver(typeof(HttpChannelReceiver)); channelFactory.RegisterSender(typeof(HttpChannelSender)); var channelManager = MockRepository.GenerateStub <IMangageReceiveChannels>(); channelManager.Stub(x => x.GetReceiveChannels()).Return(new[] { new ReceiveChannel() { Address = HttpAddressForSiteB, Type = "http", NumberOfWorkerThreads = 1 } }); channelManager.Stub(x => x.GetDefaultChannel()).Return(defaultChannelForSiteA); builder.Stub(x => x.Build <IdempotentChannelForwarder>()).Return(new IdempotentChannelForwarder(channelFactory) { DataBus = databusForSiteA }); builder.Stub(x => x.Build <IReceiveMessagesFromSites>()).Return(new IdempotentChannelReceiver(channelFactory, new InMemoryPersistence()) { DataBus = databusForSiteB }); builder.Stub(x => x.BuildAll <IRouteMessagesToSites>()).Return(new[] { new KeyPrefixConventionSiteRouter() }); messageSender = new FakeMessageSender(); receiverInSiteB = new GatewayReceiver(channelManager, new DefaultEndpointRouter { MainInputAddress = EndpointAddressForSiteB }, builder, messageSender); dispatcherInSiteA = new GatewaySender(builder, channelManager, MockRepository.GenerateStub <IMessageNotifier>(), MockRepository.GenerateStub <ISendMessages>(), new FakeDispatcherSettings { Receiver = inMemoryReceiver, FailureManager = MockRepository.GenerateStub <IManageMessageFailures>() }); dispatcherInSiteA.Start(GatewayAddressForSiteA); receiverInSiteB.Start(GatewayAddressForSiteB); }
internal void Start() { acceptor.Start(); for (int i = 0; i < senders.Length; i++) { int capture = i; senders[capture] = new Lazy <GatewaySender>(() => { var sender = new GatewaySender("GatewaySiloSender_" + capture, this); sender.Start(); return(sender); }, LazyThreadSafetyMode.ExecutionAndPublication); } dropper.Start(); }
internal void Start(ClientObserverRegistrar clientRegistrar) { this.clientRegistrar = clientRegistrar; this.clientRegistrar.SetGateway(this); acceptor.Start(); for (int i = 0; i < senders.Length; i++) { int capture = i; senders[capture] = new Lazy <GatewaySender>(() => { var sender = new GatewaySender("GatewaySiloSender_" + capture, this); sender.Start(); return(sender); }, LazyThreadSafetyMode.ExecutionAndPublication); } dropper.Start(); }
public void SetUp() { databusForSiteA = new InMemoryDataBus(); databusForSiteB = new InMemoryDataBus(); inMemoryReceiver = new InMemoryReceiver(); var builder = MockRepository.GenerateStub<IBuilder>(); var channelFactory = new ChannelFactory(); channelFactory.RegisterReceiver(typeof(HttpChannelReceiver)); channelFactory.RegisterSender(typeof(HttpChannelSender)); var channelManager = MockRepository.GenerateStub<IMangageReceiveChannels>(); channelManager.Stub(x => x.GetActiveChannels()).Return(new[] {new Channel { Address = HttpAddressForSiteB, Type = "http" }}); channelManager.Stub(x => x.GetDefaultChannel()).Return(defaultChannelForSiteA); builder.Stub(x => x.Build<IdempotentChannelForwarder>()).Return(new IdempotentChannelForwarder(channelFactory) { DataBus = databusForSiteA }); builder.Stub(x => x.Build<IReceiveMessagesFromSites>()).Return(new IdempotentChannelReceiver(channelFactory, new InMemoryPersistence()) { DataBus = databusForSiteB }); builder.Stub(x => x.BuildAll<IRouteMessagesToSites>()).Return(new[] { new KeyPrefixConventionSiteRouter() }); messageSender = new FakeMessageSender(); receiverInSiteB = new GatewayReceiver(channelManager,new DefaultEndpointRouter { MainInputAddress = EndpointAddressForSiteB },builder,messageSender); dispatcherInSiteA = new GatewaySender(builder, channelManager, MockRepository.GenerateStub<IMessageNotifier>(), MockRepository.GenerateStub<ISendMessages>(), new FakeDispatcherSettings { Receiver = inMemoryReceiver }); dispatcherInSiteA.Start(GatewayAddressForSiteA); receiverInSiteB.Start(GatewayAddressForSiteB); }
public void SetUp() { databusForSiteA = new InMemoryDataBus(); databusForSiteB = new InMemoryDataBus(); fakeTransport = new FakeTransport(); var builder = MockRepository.GenerateStub<IBuilder>(); var channelFactory = new ChannelFactory(); channelFactory.RegisterReceiver(typeof(HttpChannelReceiver)); channelFactory.RegisterSender(typeof(HttpChannelSender)); var channelManager = MockRepository.GenerateStub<IManageReceiveChannels>(); channelManager.Stub(x => x.GetReceiveChannels()).Return(new[] {new ReceiveChannel() { Address = HttpAddressForSiteB, Type = "http", NumberOfWorkerThreads = 1 }}); channelManager.Stub(x => x.GetDefaultChannel()).Return(defaultChannelForSiteA); builder.Stub(x => x.Build<IdempotentChannelForwarder>()).Return(new IdempotentChannelForwarder(channelFactory) { DataBus = databusForSiteA }); builder.Stub(x => x.Build<IReceiveMessagesFromSites>()).Return(new IdempotentChannelReceiver(channelFactory, new InMemoryPersistence()) { DataBus = databusForSiteB }); builder.Stub(x => x.BuildAll<IRouteMessagesToSites>()).Return(new[] { new KeyPrefixConventionSiteRouter() }); messageSender = new FakeMessageSender(); receiverInSiteB = new GatewayReceiver(); receiverInSiteB.ChannelManager = channelManager; receiverInSiteB.EndpointRouter = new DefaultEndpointRouter { MainInputAddress = EndpointAddressForSiteB }; receiverInSiteB.MessageSender = messageSender; receiverInSiteB.builder = builder; //receiverInSiteB.InputAddress = GatewayAddressForSiteA; dispatcherInSiteA = new GatewaySender(); dispatcherInSiteA.ChannelManager = channelManager; dispatcherInSiteA.Builder = builder; dispatcherInSiteA.MessageSender = MockRepository.GenerateStub<ISendMessages>(); dispatcherInSiteA.Notifier = MockRepository.GenerateStub<IMessageNotifier>(); // dispatcherInSiteA.InputAddress = GatewayAddressForSiteA; dispatcherInSiteA.Start(); receiverInSiteB.Start(); }