예제 #1
0
        private static IBrokerConfigSender GetBrokerConfigSender()
        {
            IBrokerConfigSender configSender = new BrokerConfigSender
            {
                Username              = "******",
                Password              = "******",
                Host                  = hostName,
                VirtualHost           = "/",
                RoutingKeyOrQueueName = "MyTestQueue"
            };

            return(configSender);
        }
예제 #2
0
        public static BrokerConfigSender GetBrokerConfigSender(this IConfiguration configuration, string sectionName)
        {
            var section = configuration.GetSection(sectionName);

            bool.TryParse(section["ShuffleHostList"], out var shuffleHostList);
            bool.TryParse(section["UseTLS"], out var useTls);

            var conf = new BrokerConfigSender
            {
                Host                  = section["Host"],
                Port                  = Convert.ToInt16(section["Port"]),
                Password              = section["Password"],
                VirtualHost           = section["VirtualHost"],
                Username              = section["Username"],
                Exchange              = section["Exchange"],
                RoutingKeyOrQueueName = section["RoutingKeyOrQueueName"],
                ShuffleHostList       = shuffleHostList,
                UseTLS                = useTls
            };

            return(conf);
        }