/// <summary>
        /// Withs the RabbitMQ bus (read config from configuration file).
        /// </summary>
        /// <param name="options">Options.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="sectionName">The section name in the configuration file.</param>
        public static EasyCachingOptions WithRabbitMQBus(
            this EasyCachingOptions options
            , IConfiguration configuration
            , string sectionName = EasyCachingConstValue.RabbitMQBusSection
            )
        {
            var dbConfig   = configuration.GetSection(sectionName);
            var busOptions = new RabbitMQBusOptions();

            dbConfig.Bind(busOptions);

            void configure(RabbitMQBusOptions x)
            {
                x.HostName                   = busOptions.HostName;
                x.Password                   = busOptions.Password;
                x.Port                       = busOptions.Port;
                x.QueueMessageExpires        = busOptions.QueueMessageExpires;
                x.RequestedConnectionTimeout = busOptions.RequestedConnectionTimeout;
                //x.RouteKey = busOptions.RouteKey;
                x.SocketReadTimeout  = busOptions.SocketReadTimeout;
                x.SocketWriteTimeout = busOptions.SocketWriteTimeout;
                x.TopicExchangeName  = busOptions.TopicExchangeName;
                x.UserName           = busOptions.UserName;
                x.VirtualHost        = busOptions.VirtualHost;
                x.QueueName          = busOptions.QueueName;
            }

            options.RegisterExtension(new RabbitMQBusOptionsExtension(configure));
            return(options);
        }
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddEasyCaching(option =>
            {
                // local
                option.UseInMemory("m1");
                // distributed
                option.UseRedis(config =>
                {
                    config.DBConfig.Endpoints.Add(new ServerEndPoint("127.0.0.1", 6379));
                    config.DBConfig.Database = 5;
                }, "myredis");

                // combine local and distributed
                option.UseHybrid(config =>
                {
                    config.TopicName = "test-topic";
                    ////rabbitmq bus should use route key
                    //config.TopicName = "rmq.queue.undurable.easycaching.subscriber.*";

                    config.EnableLogging = true;

                    // specify the local cache provider name after v0.5.4
                    config.LocalCacheProviderName = "m1";
                    // specify the distributed cache provider name after v0.5.4
                    config.DistributedCacheProviderName = "myredis";
                })
                //// use redis bus
                // .WithRedisBus(busConf =>
                // {
                //     busConf.Endpoints.Add(new ServerEndPoint("127.0.0.1", 6379));
                // });
                //// use csredis bus
                //.WithCSRedisBus(busConf =>
                //{
                //    busConf.ConnectionStrings = new System.Collections.Generic.List<string>
                //    {
                //        "127.0.0.1:6379,defaultDatabase=13,poolsize=10"
                //    };
                //})
                //use rabbitmq bus
                .WithRabbitMQBus(busConf =>
                {
                    busConf = new RabbitMQBusOptions();
                });
            });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }