Пример #1
0
        /// <summary>
        /// Starts active monitoring of transports
        /// </summary>
        public void StartMonitoring()
        {
            lock (lockObj)
            {
                if (running)
                {
                    return;
                }

                poller.RunAsync();

                foreach (var sender in senders)
                {
                    sender.InitializeConnection();
                }

                foreach (var receiver in receivers)
                {
                    receiver.InitializeConnection();
                }

                foreach (var publisher in publishers)
                {
                    publisher.InitializeConnection();
                }

                foreach (var subscriber in subscribers)
                {
                    subscriber.InitializeConnection();
                }

                running = true;
            }
        }
Пример #2
0
        public Task StartAsync(HostingApplication hostingApplication, CancellationToken cancellationToken)
        {
            _routerSocket = new RouterSocket();
            _routerSocket.Bind($"tcp://{_hostingOptions.Host}");
            _routerSocket.ReceiveReady += RouterSocket_ReceiveReady;
            _dealerSocket = new DealerSocket();
            _dealerSocket.Bind(INPROC_SERVER_URL);
            _dealerSocket.ReceiveReady += DealerSocket_ReceiveReady;
            _poller = new NetMQPoller {
                _routerSocket, _dealerSocket
            };
            _poller.RunAsync();

            return(Task.CompletedTask);
        }
Пример #3
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            if (!connected)
            {
                socket = new SubscriberSocket(_configuration["NetMQ:SubscribeConnection"]);
                socket.Options.ReceiveHighWatermark = 1000;
                socket.Subscribe(_configuration["EventBus:Topic"]);
                socket.ReceiveReady += ReceieveMessage;
                poller = new NetMQPoller {
                    socket
                };
                poller.RunAsync();
                connected = true;
            }

            return(Task.CompletedTask);
        }