Esempio n. 1
0
        public Task <IDisposable> Subscribe(ConsumerSetup setup)
        {
            var topicName = string.IsNullOrWhiteSpace(setup.Topic)
                ? _namingStrategy.GetTopicName(setup.MessageType, _configuration.ServiceName)
                : setup.Topic;

            var queueName = string.IsNullOrWhiteSpace(setup.QueueName)
                ? _namingStrategy.GetQueueName(setup.MessageType, _configuration.ServiceName)
                : setup.QueueName;

            var subscribe = (Task <IDisposable>) this
                            .GetType()
                            .GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
                            .FirstOrDefault(x => x.Name == nameof(SetupSubscription))
                            //.GetMethod("SetupSubscription", BindingFlags.NonPublic)
                            ?.MakeGenericMethod(new[] { setup.MessageType })
                            .Invoke(this, new[] { topicName, queueName });

            return(subscribe);
        }
Esempio n. 2
0
 public Task <IDisposable> Subscribe(ConsumerSetup setup)
 {
     return(_subscriber.Subscribe(setup));
 }