public void SetupApi()
 {
     query = ConfigurationHelpers.RabbitMqQueryWithConfigSettings();
     connection = ConfigurationHelpers.ChannelWithAppConfigSettings();
     var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig();
     router = new RabbitRouter(connection, shortTermConnection);
 }
 public SkypeManager(ILogHandler logger, IMessageRouter<IMessage> messageRouter, List<ISkypeBehaviour> skypeBehaviours)
 {
     Logger = logger;
     MessageRouter = messageRouter;
     AttachedBehaviours = skypeBehaviours;
     Priority = Priority.Normal;
 }
 public void SetUp()
 {
     var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings();
     var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig();
     router = new RabbitRouter(longTermConnection, shortTermConnection);
     subject = new TypeRouter(router);
 }
 public BlyncLightManager(ILogHandler logger, IMessageRouter<IMessage> messageRouter, List<IBlyncLightBehaviour> blyncLightBehaviours)
 {
     Logger = logger;
     MessageRouter = messageRouter;
     AttachedBehaviours = blyncLightBehaviours;
     Priority = Priority.High;
     DeviceStatus = DeviceStatus.Disconnected;
 }
        public void A_routing_table_build_from_IMetadataFile()
        {
            router = Substitute.For<IMessageRouter>();

            subject = new TypeRouter(router);

            subject.BuildRoutes(typeof(Example.Types.IMetadataFile));
        }
        public void When_setting_up_a_named_destination()
        {
            typeRouter = Substitute.For<ITypeRouter>();
            messageRouter = Substitute.For<IMessageRouter>();
            serialiser = Substitute.For<IMessageSerialiser>();

            messaging = new MessagingBase(typeRouter, messageRouter, serialiser);
            messaging.ResetCaches();
        }
Exemple #7
0
 public WeatherService(IWeatherRequestScheduler weatherRequestScheduler,
                       IMessageRouter messageRouter,
                       IActorHostManager actorHostManager,
                       IEnumerable<IActor> actors)
 {
     this.messageRouter = messageRouter;
     this.actorHostManager = actorHostManager;
     this.weatherRequestScheduler = weatherRequestScheduler;
     actors.ForEach(a => actorHostManager.AssignActor(a));
 }
        public void When_setting_up_a_named_destination()
        {
            typeRouter = Substitute.For<ITypeRouter>();
            messageRouter = Substitute.For<IMessageRouter>();
            serialiser = Substitute.For<IMessageSerialiser>();

            messaging = new MessagingBase(typeRouter, messageRouter, serialiser);
            messaging.ResetCaches();
            messaging.CreateDestination<IMetadataFile>("MyServiceDestination");
        }
        public void Routing_a_type_1000_times()
        {
            router = Substitute.For<IMessageRouter>();
            subject = new TypeRouter(router);

            var start = DateTime.Now;
            for (int i = 0; i < 1000; i++)
            {
                subject.BuildRoutes(typeof(Example.Types.SuperMetadata));
            }
            var time = DateTime.Now - start;
            Assert.Pass("Took "+time);
        }
        public void SetUp()
        {
            var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings();
            var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig();
            subject = new RabbitRouter(longTermConnection, shortTermConnection);

            typeRouter = new TypeRouter(subject);
            typeRouter.BuildRoutes(typeof(IFile));

            subject.AddDestination("dst");
            subject.Link("Example.Types.IMsg", "dst");
            subject.Send("Example.Types.IFile", "Hello");
        }
        public void When_setting_up_a_named_destination()
        {
            metadataMessage = new SuperMetadata();

            badMessage = new {Who="What"};
            typeRouter = Substitute.For<ITypeRouter>();
            messageRouter = Substitute.For<IMessageRouter>();
            serialiser = Substitute.For<IMessageSerialiser>();
            serialiser.Serialise(metadataMessage).Returns(serialisedObject);

            messaging = new MessagingBase(typeRouter, messageRouter, serialiser);
            messaging.ResetCaches();
            messaging.SendMessage(metadataMessage);
        }
		/// <summary>
		/// Create a new node factory.
		/// You don't need to create this yourself, use `MessagingSystem.Receiver()`
		/// </summary>
		public Receiver(
			IUniqueEndpointGenerator uniqueEndPointGenerator,
			IMessageRouter messageRouter,
			IPollingNodeFactory pollerFactory,
			IDispatcherFactory dispatchFactory)
		{
			_messageRouter = messageRouter;
			_pollerFactory = pollerFactory;
			_dispatchFactory = dispatchFactory;
			_uniqueEndPointGenerator = uniqueEndPointGenerator;
			_lockObject = new object();
			_registeredNodes = new ConcurrentBag<IReceiverNode>();
			PurgeOnConnect = false;
			DeleteIntegrationEndpointsOnShutdown = false;
		}
		public void setup()
		{
			_endpointGenerator = Substitute.For<IUniqueEndpointGenerator>();
			_handlerManager = Substitute.For<IHandlerManager>();
			_messageRouter = Substitute.For<IMessageRouter>();
			_pollerFactory = Substitute.For<IPollingNodeFactory>();
			_dispatchFactory = Substitute.For<IDispatcherFactory>();

			ObjectFactory.Configure(map=>map.For<IHandlerManager>().Use(_handlerManager));
			_endpointGenerator.Generate().Returns(new Endpoint("zoso"));


			_subject = new Receiver(
				_endpointGenerator,
				_messageRouter, _pollerFactory, _dispatchFactory);
		}
        public StompTransport(string address, int port)
        {
            _client = new TcpClient();
            _client.Connect(address, port);

            _messageFactory = new StreamMessageFactory(new StreamReader(_client.GetStream(), ASCII8BitEncoding));
            _messageSerializer =
                 new MessageSerializerQueue(
                    new StreamMessageSerializer(new StreamWriter(_client.GetStream(), ASCII8BitEncoding)));

            _incommingMessageRouter = new MessageRouter(_incommingMessagesSubject);

            Task.Factory.StartNew(ReadLoop);

            using (var lateSubscriber = new LateSubscriber<IMessage>(IncommingMessages.GetObservable("CONNECTED")))
            {
                SendMessage(new MessageBuilder("CONNECT").Header("accept-version", 1.2).WithoutBody()).Wait();

                lateSubscriber.RecordedItems.FirstAsync().Wait();
            }
        }
        public MqttIotHubAdapter(
            Settings settings,
            ISessionStatePersistenceProvider sessionStateManager,
            IDeviceIdentityProvider authProvider,
            IQos2StatePersistenceProvider qos2StateProvider,
            IMessagingFactory messagingFactory,
            IMessageRouter messageRouter)
        {
            Contract.Requires(settings != null);
            Contract.Requires(sessionStateManager != null);
            Contract.Requires(authProvider != null);
            Contract.Requires(messageRouter != null);

            if (qos2StateProvider != null)
            {
                this.maxSupportedQosToClient = QualityOfService.ExactlyOnce;
                this.qos2StateProvider = qos2StateProvider;
            }
            else
            {
                this.maxSupportedQosToClient = QualityOfService.AtLeastOnce;
            }

            this.settings = settings;
            this.sessionStateManager = sessionStateManager;
            this.authProvider = authProvider;
            this.messagingFactory = messagingFactory;
            this.messageRouter = messageRouter;

            this.publishProcessor = new MessageAsyncProcessor<PublishPacket>(this.PublishToServerAsync);
            this.publishProcessor.Completion.OnFault(ShutdownOnPublishToServerFaultAction);

            TimeSpan? ackTimeout = this.settings.DeviceReceiveAckCanTimeout ? this.settings.DeviceReceiveAckTimeout : (TimeSpan?)null;
            this.publishPubAckProcessor = new RequestAckPairProcessor<AckPendingMessageState, PublishPacket>(this.AcknowledgePublishAsync, this.RetransmitNextPublish, ackTimeout);
            this.publishPubAckProcessor.Completion.OnFault(ShutdownOnPubAckFaultAction);
            this.publishPubRecProcessor = new RequestAckPairProcessor<AckPendingMessageState, PublishPacket>(this.AcknowledgePublishReceiveAsync, this.RetransmitNextPublish, ackTimeout);
            this.publishPubRecProcessor.Completion.OnFault(ShutdownOnPubRecFaultAction);
            this.pubRelPubCompProcessor = new RequestAckPairProcessor<CompletionPendingMessageState, PubRelPacket>(this.AcknowledgePublishCompleteAsync, this.RetransmitNextPublishRelease, ackTimeout);
            this.pubRelPubCompProcessor.Completion.OnFault(ShutdownOnPubCompFaultAction);
        }
Exemple #16
0
        public MultiEndpointServiceConnectionContainer(string hub, Func <HubServiceEndpoint, IServiceConnectionContainer> generator, IServiceEndpointManager endpointManager, IMessageRouter router, IClientConnectionLifetimeManager lifetime, ILoggerFactory loggerFactory)
        {
            if (generator == null)
            {
                throw new ArgumentNullException(nameof(generator));
            }

            _clientLifetime = lifetime;

            _logger = loggerFactory?.CreateLogger <MultiEndpointServiceConnectionContainer>() ?? throw new ArgumentNullException(nameof(loggerFactory));

            // provides a copy to the endpoint per container
            _endpoints = endpointManager.GetEndpoints(hub);

            if (_endpoints.Count == 1)
            {
                _inner = generator(_endpoints[0]);
            }
            else
            {
                // router is required when endpoints > 1
                _router     = router ?? throw new ArgumentNullException(nameof(router));
                Connections = _endpoints.ToDictionary(s => (ServiceEndpoint)s, s => generator(s));
            }
        }
 public ImportedToolV2(IMessageRouter router, string cachePath, string version, string assemDir)
     : base(cachePath, version, assemDir)
 {
     _messageRouter = router;
 }
 public SendFeedbackDialog(IMessageRouter router)
 {
     _router = router;
 }
 public void Add(IMessageRouter messageRouter)
 {
     _routers.Add(messageRouter);
 }
Exemple #20
0
        /// <summary>
        /// 异步向各个订阅的客户端发布消息。
        /// </summary>
        /// <typeparam name="TMessage">待发送消息的类型。</typeparam>
        /// <param name="obj">一个消息路由扩展接口的实例对象。</param>
        /// <param name="msg">待发送的消息实例对象。</param>
        /// <returns>一个表示异步消息状态的实例对象。</returns>
        public static IAsyncResult PublishAsync <TMessage>(this IMessageRouter obj, TMessage msg)
        {
            Func <IMessageRouter, TMessage, EventContext> func = Publish;

            return(func.BeginInvoke(obj, msg, null, null));
        }
Exemple #21
0
 public UnitOutgoingPipelineFactory(Func <TransportMessage, Task> onMessage, ICollection <LogicalMessage> outgoing, IMessageRouter router)
 {
     this.router    = router;
     this.onMessage = onMessage;
     this.outgoing  = outgoing;
 }
 public MessageUnit Use(IMessageRouter router)
 {
     this.router = router;
     return(this);
 }
        public void Setup()
        {
            _networkMock = new Mock <INetworkHandler>();

            _messageRouter = new MessageRouter(_networkMock.Object);

            _channels = new[]
            {
                new Channel
                {
                    Id             = Guid.NewGuid(),
                    ConnectionType = ConnectionType.Duplex,
                    ChannelType    = ChannelType.Ground,
                    FirstNodeId    = 0,
                    ErrorChance    = 0.5,
                    SecondNodeId   = 1,
                    Price          = 10
                },
                new Channel
                {
                    Id             = Guid.NewGuid(),
                    ConnectionType = ConnectionType.Duplex,
                    ChannelType    = ChannelType.Ground,
                    FirstNodeId    = 0,
                    ErrorChance    = 0.5,
                    SecondNodeId   = 2,
                    Price          = 20
                },
                new Channel
                {
                    Id             = Guid.NewGuid(),
                    ConnectionType = ConnectionType.Duplex,
                    ChannelType    = ChannelType.Ground,
                    FirstNodeId    = 1,
                    ErrorChance    = 0.5,
                    SecondNodeId   = 3,
                    Price          = 100
                },
                new Channel
                {
                    Id             = Guid.NewGuid(),
                    ConnectionType = ConnectionType.Duplex,
                    ChannelType    = ChannelType.Ground,
                    FirstNodeId    = 2,
                    ErrorChance    = 0.5,
                    SecondNodeId   = 3,
                    Price          = 1
                },
            };

            _nodes = new[]
            {
                new Node
                {
                    Id                   = 0,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 1, 2 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>
                    {
                        new MessageQueueHandler(_channels[0].Id),
                        new MessageQueueHandler(_channels[1].Id)
                    },
                    IsActive = true
                },
                new Node
                {
                    Id                   = 1,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 0, 3 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>
                    {
                        new MessageQueueHandler(_channels[0].Id),
                        new MessageQueueHandler(_channels[2].Id)
                    },
                    IsActive = true
                },
                new Node
                {
                    Id                   = 2,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 0, 3 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>
                    {
                        new MessageQueueHandler(_channels[1].Id),
                        new MessageQueueHandler(_channels[3].Id)
                    },
                    IsActive = true
                },
                new Node
                {
                    Id                   = 3,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 1, 2 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>
                    {
                        new MessageQueueHandler(_channels[2].Id),
                        new MessageQueueHandler(_channels[3].Id)
                    },
                    IsActive = true
                },
                new Node
                {
                    Id                   = 4,
                    LinkedNodesId        = new SortedSet <uint>(),
                    MessageQueueHandlers = new List <MessageQueueHandler>(),
                    IsActive             = true
                }
            };

            _networkMock.Setup(n => n.Nodes)
            .Returns(_nodes);

            _networkMock.Setup(n => n.Channels)
            .Returns(_channels);

            _networkMock.Setup(n => n.GetNodeById(It.IsAny <uint>()))
            .Returns((uint nodeId) => _nodes.FirstOrDefault(n => n.Id == nodeId));

            _networkMock.Setup(n => n.GetChannel(It.IsAny <uint>(), It.IsAny <uint>()))
            .Returns((uint firstNodeId, uint secondNodeId) =>
            {
                return(_channels.FirstOrDefault(c => c.FirstNodeId == firstNodeId && c.SecondNodeId == secondNodeId
                                                ||
                                                c.FirstNodeId == secondNodeId && c.SecondNodeId == firstNodeId));
            }
                     );
        }
Exemple #24
0
        private void InitializeAllServices(double messageGenerateChance, int tableUpdatePeriod,
                                           bool isPackageMode, bool isRouterStupid, int messagesSize)
        {
            if (isRouterStupid)
            {
                _messageRouter = new IndependentMessageRouter(_network);
            }
            else
            {
                _messageRouter = new MessageRouter(_network);
            }


            if (isPackageMode)
            {
                _messageCreator = new PackageMessageCreator(_network, _messageRouter);
            }
            else
            {
                _messageCreator = new RequestMessageCreator(_network, _messageRouter);
            }

            _positiveResponseMessageCreator = new PositiveResponseCreator(_network, _messageRouter);
            _negativeResponseMessageCreator = new NegativeResponseCreator(_network, _messageRouter);

            _messageHandler   = new MessageHandler(_network, _messageCreator, _positiveResponseMessageCreator);
            _messageReceiver  = new MessageReceiver(_messageHandler, _negativeResponseMessageCreator);
            _messageExchanger = new MessageExchanger(_network, _messageReceiver);

            if (messagesSize > 0)
            {
                _messageGenerator = new SpecifiedSizeMessageGenerator(_network, _messageCreator, messageGenerateChance,
                                                                      messagesSize);
            }
            else
            {
                _messageGenerator = new MessageGenerator(_network, _messageCreator, messageGenerateChance);
            }


            _messageRepository  = new MessageRepository(_network);
            _messageViewUpdater = new MessageViewUpdater(_messageRepository, Messages);

            _messageRegistrator = new MessageRegistrator(_messageRepository);

            _messagesStatisticCounter = new MessagesStatisticCounter(_messageRegistrator, _messageRepository);

            _backgroundWorker = new Background.BackgroundWorker(_messageExchanger, _messageGenerator,
                                                                _networkDrawer, _messageCreator, _messageRegistrator, _messageViewUpdater, tableUpdatePeriod);

            _messageCreator.UpdateTables();

            FiltrationModeSelect_OnSelectionChanged(FiltrationModeSelect, null);

            _backgroundWorker.Run();

            _backgroundWorker.Interval = IntervalSlider.Value;

            _headerUpdater = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(IntervalSlider.Value)
            };

            _headerUpdater.Tick += (sender, args) => Title = $"Coursework (time: {_backgroundWorker.Ticks})";

            _headerUpdater.Start();
        }
 /// <summary>
 /// Create a type router to drive the given message router.
 /// You don't need to do this yourself -- Use `MessagingBaseConfiguration`
 /// </summary>
 public TypeRouter(IMessageRouter router)
 {
     this.router = router;
 }
Exemple #26
0
 /// <summary>
 /// 创建一个附带消息订阅的缓存通知实例对象。
 /// </summary>
 /// <typeparam name="T">需要监听的消息实体类型</typeparam>
 /// <param name="router">当前正在使用的消息路由实例对象。</param>
 /// <returns>一个缓存项移除通知的实例对象。</returns>
 public static CacheNotification CreateInstance <T>(IMessageRouter router)
 {
     return(new KeyMessageNotification <T>(router));
 }
Exemple #27
0
 public static SubscribeFluent Subscribe(this IMessageRouter router, string incomingRouteName)
 {
     return(new SubscribeFluent(router, incomingRouteName));
 }
 public OutgoingPipelineFactory(IMessageRouter router)
 {
     this.router = router;
 }
Exemple #29
0
 public IProducerBuilder <TMessage> MessageRouter(IMessageRouter messageRouter)
 {
     _messageRouter = messageRouter;
     return(this);
 }
Exemple #30
0
 public MultiEndpointServiceConnectionContainer(IServiceConnectionFactory serviceConnectionFactory, string hub,
                                                int count, IServiceEndpointManager endpointManager, IMessageRouter router, IServerNameProvider nameProvider, ILoggerFactory loggerFactory)
     : this(endpoint => CreateContainer(serviceConnectionFactory, endpoint, hub, count, endpointManager, nameProvider, loggerFactory),
            endpointManager, router, loggerFactory)
 {
 }
 private static void StartMessageRouter(IMessageRouter messageRouter)
 {
     messageRouter.Start();
     Thread.Sleep(AsyncOpCompletionDelay);
 }
 public OutgoingPipelineFactory(MessagingFactory factory, IMessageRouter router)
 {
     this.router = router;
     this.factory = factory;
 }
Exemple #33
0
 public ServiceInterface()
 {
     _MessageRouter = _MessageRouterManager.CreateMessageRouter("ShotscopeNxInterface", true);
 }
 public static void Configure(string fileName, bool ensureSecurity)
 {
     RemotingConfiguration.Configure(fileName, false);
     MessageManager = new MessageRouter();
 }
Exemple #35
0
 public static IReadOnlyCollection <Address> NoDestination(this IMessageRouter router)
 {
     return(new ReadOnlyCollection <Address>(new List <Address>()));
 }
Exemple #36
0
 public CommandBus(IMessageRouter messageRouter)
 {
     this.messageRouter = messageRouter;
 }
Exemple #37
0
 public static IReadOnlyCollection <Address> To(this IMessageRouter router, Topic topic)
 {
     return(new ReadOnlyCollection <Address>(new List <Address> {
         topic
     }));
 }
Exemple #38
0
 /// <summary>
 /// 向各个订阅的客户端发布消息。
 /// </summary>
 /// <typeparam name="TMessage">待发送消息的类型。</typeparam>
 /// <param name="obj">一个消息路由扩展接口的实例对象。</param>
 /// <param name="msg">待发送的消息实例对象。</param>
 /// <returns>发布管道的执行上下文。</returns>
 public static EventContext Publish <TMessage>(this IMessageRouter obj, TMessage msg)
 {
     return(obj.Publish(typeof(TMessage).AssemblyQualifiedName, msg));
 }
Exemple #39
0
 public static void Stop()
 {
     RemotingServices.Unmarshal(objRef);
     messageManager = null;
 }
Exemple #40
0
        //public long PerfMessagesPerSecond { get; private set; }

        public MessageProcessor(IMessageListener <T> listener, IMessageParser <T> parser, IMessageRouter router, Func <MessageProcessorInformation, Task> infoFuncAsync = null)
        {
            Listener = listener;
            Parser   = parser;
            Router   = router;

            if (infoFuncAsync != null)
            {
                _infoFuncAsync = infoFuncAsync;
                _infoTimer     = new Timer(OnTimer, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
            }
        }
 public SkypeStatusResponder(IMessageRouter<IMessage> messageRouter)
 {
     MessageRouter = messageRouter;
     Priority = Priority.Normal;
 }
Exemple #42
0
 public VentureMessagePublisher([NotNull] IMessageRouter messageRouter)
 {
     _messageRouter = messageRouter ?? throw new ArgumentNullException(nameof(messageRouter));
 }
Exemple #43
0
 public FirstMessageHandler(IComponentFactory factory, IMessageRouter router, IConfiguration configuration) : base(configuration)
 {
     _factory = factory;
     _router  = router;
 }
        private void Build()
        {
            var socketFactory       = new SocketFactory();
            var perfCountersManager = CreatePerfCountersManager();
            var localSocketFactory  = new LocalSocketFactory();
            var routerLocalSocket   = localSocketFactory.Create <IMessage>();

            var internalRoutingTable         = new InternalRoutingTable();
            var externalRoutingTable         = new ExternalRoutingTable(logger);
            var scaleOutConfigurationManager = new ScaleOutConfigurationManager(configurationProvider.GetRouterConfiguration(),
                                                                                configurationProvider.GetScaleOutConfiguration());

            var rendezvousConfigurationStorage = new RendezvousClusterConfigurationReadonlyStorage(configurationProvider.GetRendezvousEndpointsConfiguration());
            var rendezvousCluster = new RendezvousCluster(rendezvousConfigurationStorage);
            var securityProider   = new SecurityProvider(() => HMAC.Create("HMACMD5"),
                                                         domainScopeResolver,
                                                         domainPrivateKeyProvider);
            var autoDiscoverSender = new AutoDiscoverySender(rendezvousCluster,
                                                             scaleOutConfigurationManager,
                                                             socketFactory,
                                                             perfCountersManager,
                                                             securityProider,
                                                             logger);
            var autoDiscoverListener = new AutoDiscoveryListener(rendezvousCluster,
                                                                 socketFactory,
                                                                 scaleOutConfigurationManager,
                                                                 autoDiscoverSender,
                                                                 configurationProvider.GetClusterMembershipConfiguration(),
                                                                 perfCountersManager,
                                                                 securityProider,
                                                                 routerLocalSocket,
                                                                 logger);
            var routeDiscovery = new RouteDiscovery(autoDiscoverSender,
                                                    scaleOutConfigurationManager,
                                                    configurationProvider.GetClusterMembershipConfiguration(),
                                                    securityProider,
                                                    logger);
            var heartBeatSenderConfigurationManager = new HeartBeatSenderConfigurationManager(configurationProvider.GetHeartBeatSenderConfiguration());
            var clusterConnectivity = new ClusterConnectivity(configurationProvider.GetClusterMembershipConfiguration(),
                                                              scaleOutConfigurationManager,
                                                              autoDiscoverSender,
                                                              autoDiscoverListener,
                                                              routeDiscovery,
                                                              socketFactory,
                                                              routerLocalSocket,
                                                              scaleOutConfigurationManager,
                                                              securityProider,
                                                              perfCountersManager,
                                                              logger,
                                                              heartBeatSenderConfigurationManager,
                                                              localSocketFactory,
                                                              configurationProvider.GetClusterHealthMonitorConfiguration());
            var internalRegistrationsSocket  = localSocketFactory.Create <InternalRouteRegistration>();
            var internalRegistrationsHandler = new InternalMessageRouteRegistrationHandler(clusterConnectivity,
                                                                                           internalRoutingTable,
                                                                                           securityProider,
                                                                                           logger);

            messageRouter = new MessageRouter(socketFactory,
                                              internalRoutingTable,
                                              externalRoutingTable,
                                              scaleOutConfigurationManager,
                                              clusterConnectivity,
                                              CreateServiceMessageHandlers(clusterConnectivity,
                                                                           externalRoutingTable,
                                                                           internalRoutingTable,
                                                                           securityProider),
                                              perfCountersManager,
                                              securityProider,
                                              routerLocalSocket,
                                              internalRegistrationsSocket,
                                              internalRegistrationsHandler,
                                              logger);

            actorHostManager = new ActorHostManager(securityProider,
                                                    perfCountersManager,
                                                    routerLocalSocket,
                                                    internalRegistrationsSocket,
                                                    localSocketFactory,
                                                    logger);
            var callbackHandlerStack = new CallbackHandlerStack();

            messageHub = new MessageHub(callbackHandlerStack,
                                        perfCountersManager,
                                        routerLocalSocket,
                                        internalRegistrationsSocket,
                                        localSocketFactory,
                                        logger,
                                        false);
        }
Exemple #45
0
 public UnitOutgoingPipelineFactory(Func<TransportMessage, Task> onMessage, ICollection<LogicalMessage> outgoing, IMessageRouter router)
 {
     this.router = router;
     this.onMessage = onMessage;
     this.outgoing = outgoing;
 }
Exemple #46
0
 public static IReadOnlyCollection <Address> To(this IMessageRouter router, Queue queue)
 {
     return(new ReadOnlyCollection <Address>(new List <Address> {
         queue
     }));
 }
 /// <summary>
 /// Creates an instance of a <see cref="ReceiptBehavior"/>
 /// for the given destination.
 /// </summary>
 /// <param name="destination">The outgoing messages destination</param>
 /// <param name="messageRouter">The incomming messages router (To listen for Receipt messages).</param>
 public ReceiptBehavior(string destination, IMessageRouter messageRouter)
 {
     _destination = destination;
     _subscription = messageRouter.GetObservable("RECEIPT").Subscribe(OnReceiptReceived);
 }
Exemple #48
0
 public MessageHandler(IMessageRouter router, IComponentFactory factory, IConfiguration configuration)
 {
     _router        = router;
     _factory       = factory;
     _configuration = configuration;
 }
 public OutgoingPipelineFactory(IMessageRouter router)
 {
     this.router = router;
 }
Exemple #50
0
 /// <summary>
 ///     Creates a new instance of <see cref="QueueListener" />.
 /// </summary>
 /// <param name="inboundQueue">Used to receive messages</param>
 /// <param name="outboundQueue">All messages enqueued in handlers will be sent to this queue</param>
 /// <param name="scopeFactory">Used to create a new scope each time a message is handled.</param>
 public QueueListener(IMessageQueue inboundQueue, IMessageQueue outboundQueue, IHandlerScopeFactory scopeFactory)
 {
     _outboundRouter = new SingleQueueRouter(outboundQueue);
     _scopeFactory   = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _queue          = inboundQueue ?? throw new ArgumentNullException(nameof(inboundQueue));
 }
Exemple #51
0
        public MultiEndpointServiceConnectionContainer(Func <ServiceEndpoint, IServiceConnectionContainer> generator, IServiceEndpointManager endpointManager, IMessageRouter router, ILoggerFactory loggerFactory)
        {
            if (generator == null)
            {
                throw new ArgumentNullException(nameof(generator));
            }

            _logger = loggerFactory?.CreateLogger <MultiEndpointServiceConnectionContainer>() ?? NullLogger <MultiEndpointServiceConnectionContainer> .Instance;

            // provides a copy to the endpoint per container
            _endpoints = endpointManager.Endpoints.Select(s => new ServiceEndpoint(s)).ToArray();

            if (_endpoints.Count == 1)
            {
                _inner = generator(_endpoints[0]);
            }
            else
            {
                // router is required when endpoints > 1
                _router     = router ?? throw new ArgumentNullException(nameof(router));
                Connections = _endpoints.ToDictionary(s => s, s => generator(s));
            }
        }
Exemple #52
0
 public void Handle(SubscriptionsChanged message, IMessageRouter router)
 {
     router.ClearAll();
 }
 public void A_routing_table_build_from_a_class_implementing_IMetadataFile()
 {
     router = Substitute.For<IMessageRouter>();
     subject = new TypeRouter(router);
     subject.BuildRoutes(typeof(SuperMetadata));
 }
Exemple #54
0
 public MessageUnit Use(IMessageRouter router)
 {
     this.Router = router;
     return this;
 }
 public DetermineDestinationStep(IMessageRouter router)
 {
     this.router = router;
 }