public static ServiceBusProducerConfig Bind(IConfiguration configuration) { var options = new ServiceBusProducerConfig(); configuration.GetSection(nameof(ServiceBusProducerConfig)).Bind(options); return(options); }
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); }