Ejemplo n.º 1
0
        public static ServiceBusProducerConfig Bind(IConfiguration configuration)
        {
            var options = new ServiceBusProducerConfig();

            configuration.GetSection(nameof(ServiceBusProducerConfig)).Bind(options);
            return(options);
        }
Ejemplo n.º 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);
        }