Exemple #1
0
        public EventHubMessageBus(MessageBusSettings settings, EventHubMessageBusSettings eventHubSettings)
            : base(settings)
        {
            EventHubSettings = eventHubSettings;

            _producersByTopic.ValueFactory = topic =>
            {
                Log.DebugFormat("Creating EventHubClient for path {0}", topic);
                return(EventHubSettings.EventHubClientFactory(topic));
            };

            Log.Info("Creating consumers");
            foreach (var consumerSettings in settings.Consumers)
            {
                Log.InfoFormat("Creating consumer for Topic: {0}, Group: {1}, MessageType: {2}", consumerSettings.Topic, consumerSettings.Group, consumerSettings.MessageType);
                //var consumer = new EventHubConsumer(this, group, messageType, subscribersByMessageType.ToList());
                _consumers.Add(new EventHubConsumer(this, consumerSettings));
            }

            if (settings.RequestResponse != null)
            {
                Log.InfoFormat("Creating response consumer for Topic: {0}, Group: {1}", settings.RequestResponse.Topic, settings.RequestResponse.Group);
                // _consumers.Add(new EvenHubResponseConsumer(this, settings.RequestResponse));
                _consumers.Add(new EventHubConsumer(this, settings.RequestResponse));
            }
        }
Exemple #2
0
        public EventHubMessageBus(MessageBusSettings settings, EventHubMessageBusSettings eventHubSettings)
            : base(settings)
        {
            EventHubSettings = eventHubSettings;

            _producerByTopic = new SafeDictionaryWrapper <string, EventHubClient>(topic =>
            {
                Log.DebugFormat("Creating EventHubClient for path {0}", topic);
                return(EventHubSettings.EventHubClientFactory(topic));
            });

            Log.Info("Creating consumers");
            foreach (var consumerSettings in settings.Consumers)
            {
                Log.InfoFormat("Creating consumer for Topic: {0}, Group: {1}, MessageType: {2}", consumerSettings.Topic, consumerSettings.Group, consumerSettings.MessageType);
                _consumers.Add(new GroupTopicConsumer(this, consumerSettings));
            }

            if (settings.RequestResponse != null)
            {
                Log.InfoFormat("Creating response consumer for Topic: {0}, Group: {1}", settings.RequestResponse.Topic, settings.RequestResponse.Group);
                _consumers.Add(new GroupTopicConsumer(this, settings.RequestResponse));
            }
        }