예제 #1
0
        public LegacyMessageService()
        {
            var settings = TestSettings.MqSettingsForTopic();

            _publisher  = new AzureBusTopicPublisher(settings, Console.WriteLine, Console.WriteLine);
            _subscriber = new AzureBusTopicSubscriber(settings, Console.WriteLine, Console.WriteLine);

            Console.WriteLine("Starting legacy message service");
            var listener1 = _subscriber.Messages <CorrelationLegacyTestMessage1>();
            var listener2 = _subscriber.Messages <CorrelationLegacyTestMessage2>();
            var listener3 = _subscriber.Messages <CorrelationLegacyTestMessage3>();

            listener1.Subscribe(HandleFirstCorrelation);
            listener2.Subscribe(HandleSecondCorrelation);
            listener3.Subscribe(HandleThirdCorrelation);

            _timer = new Timer(Execute, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
        }
예제 #2
0
 public MessageService(ILogger <MessageService> logger, IMqTopicPublisher publisher, IMqTopicSubscriber subscriber)
 {
     _logger     = logger;
     _publisher  = publisher;
     _subscriber = subscriber;
 }