Esempio n. 1
0
        public ServiceBusSender(ServiceBusSetting setting, ILoggerFactory logger)
        {
            this.logger  = logger.CreateLogger <ServiceBusSender <T> >();
            this.setting = setting;
            manager      = new ServiceBusManager(setting, logger);
            manager.CreateIfNotExisted().Wait();

            sender = new MessageSender(setting.ConnectionString, setting.IsTopic ? setting.TopicPath : setting.QueueName);
        }
Esempio n. 2
0
        public ServiceBusReceiver(ServiceBusSetting setting, IMessageProcessor <T> processor, ILoggerFactory logger)
        {
            this.logger    = logger.CreateLogger <ServiceBusReceiver <T> >();
            this.processor = processor;
            this.setting   = setting;

            isTopic = setting.IsTopic;
            manager = new ServiceBusManager(setting, logger);
            manager.CreateIfNotExisted().Wait();

            if (isTopic)
            {
                manager.AddSubscribtionIfNotExisted(subscriptionId).Wait();
            }

            receiver = new MessageReceiver(setting.ConnectionString, isTopic ? $"{setting.TopicPath}/subscriptions/{subscriptionId}" : setting.QueueName);
        }