Ejemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var transport2 = new SerialPortTransport(
                _messageFactory,
                "/dev/ttyS1",
                isRS485: true,
                tsLogger);

            _messageBus.Subscribe <CardNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <BleNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <FingerNotificationHandler>(transport2.Name);
            _messageBus.Subscribe <PingAcknowledgeHandler>(transport2.Name);
            //_messageBus.TransportAdded += OnTransportAdded;
            _messageBus.AddTransport(transport2);

            //var transport = new TestTransport(_logger);
            //_transportManager.AddTransport(transport);

            //await _masstransitBc.StartAsync();
            //for (int i = 0; i < 10; i++)
            //{
            //    //await _publishEndpoint.Publish<TestEvent>(new
            //    //{
            //    //    Text = "test message"
            //    //});
            //    var endpoint = await _sendEndpoint.GetSendEndpoint(new Uri(String.Concat("queue:", Routes.HubPrefix, Program.HubId,"test_consumer")));
            //    await endpoint.Send<TestEvent>(new
            //    {
            //        Text = "test message"
            //    });
            //}
        }