예제 #1
0
        public static ServiceBusProducerConfig Bind(IConfiguration configuration)
        {
            var options = new ServiceBusProducerConfig();

            configuration.GetSection(nameof(ServiceBusProducerConfig)).Bind(options);
            return(options);
        }
예제 #2
0
        public ServiceBusProducer(ILogger logger, IConfigurationSection config)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            _logger = logger;
            var sboptions = new ServiceBusProducerConfig();

            config.Bind(sboptions);

            _topic = sboptions.Topic;

            var connectionString = new ServiceBusConnectionStringBuilder(sboptions.EndpointAddress, sboptions.Topic,
                                                                         sboptions.AuthKeyName,
                                                                         sboptions.AuthKey);

            topicClient = new TopicClient(connectionString);
        }