Пример #1
0
        public IConfiguration ToIConfiguration()
        {
            var config = new MutableConfiguration("rhino.esb");

            var busConfig = config.CreateChild("bus")
                            .Attribute("endpoint", Endpoint)
                            .Attribute("threadCount", ThreadCount.ToString())
                            .Attribute("numberOfRetries", NumberOfRetries.ToString());

            if (string.IsNullOrEmpty(Name) == false)
            {
                busConfig.Attribute("name", Name);
            }

            if (string.IsNullOrEmpty(LoadBalancerEndpoint) == false)
            {
                busConfig.Attribute("loadBalancerEndpoint", LoadBalancerEndpoint);
            }

            if (string.IsNullOrEmpty(LogEndpoint) == false)
            {
                busConfig.Attribute("logEndpoint", LogEndpoint);
            }

            var messagesConfig = config.CreateChild("messages");

            foreach (var message in Messages)
            {
                messagesConfig.CreateChild("add")
                .Attribute("name", message.Key)
                .Attribute("endpoint", message.Value);
            }

            return(config);
        }
Пример #2
0
        protected virtual void PopulateBusConfiguration(MutableConfiguration busConfig)
        {
            busConfig
            .Attribute("endpoint", Endpoint)
            .Attribute("threadCount", ThreadCount.ToString())
            .Attribute("numberOfRetries", NumberOfRetries.ToString());

            if (string.IsNullOrEmpty(Name) == false)
            {
                busConfig.Attribute("name", Name);
            }

            if (string.IsNullOrEmpty(LoadBalancerEndpoint) == false)
            {
                busConfig.Attribute("loadBalancerEndpoint", LoadBalancerEndpoint);
            }

            if (string.IsNullOrEmpty(LogEndpoint) == false)
            {
                busConfig.Attribute("logEndpoint", LogEndpoint);
            }
        }