Example #1
0
        private Cluster(IEnumerable <IPAddress> contactPoints, Configuration configuration)
        {
            _contactPoints = contactPoints;
            _configuration = configuration;
            _metadata      = new Metadata(configuration.Policies.ReconnectionPolicy);

            var controlpolicies = new Policies(
                //new ControlConnectionLoadBalancingPolicy(_configuration.Policies.LoadBalancingPolicy),
                _configuration.Policies.LoadBalancingPolicy,
                new ExponentialReconnectionPolicy(2 * 1000, 5 * 60 * 1000),
                Policies.DefaultRetryPolicy);

            foreach (IPAddress ep in _contactPoints)
            {
                Metadata.AddHost(ep);
            }

            PoolingOptions poolingOptions = new PoolingOptions()
                                            .SetCoreConnectionsPerHost(HostDistance.Local, 0)
                                            .SetMaxConnectionsPerHost(HostDistance.Local, 1)
                                            .SetMinSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 0)
                                            .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 127)
            ;

            var controlConnection = new ControlConnection(this, new List <IPAddress>(), controlpolicies,
                                                          new ProtocolOptions(_configuration.ProtocolOptions.Port,
                                                                              configuration.ProtocolOptions.SslOptions),
                                                          poolingOptions, _configuration.SocketOptions,
                                                          new ClientOptions(
                                                              true,
                                                              _configuration.ClientOptions.QueryAbortTimeout, null),
                                                          _configuration.AuthProvider,
                                                          _configuration.AuthInfoProvider,
                                                          2 //lets start from protocol version 2
                                                          );

            _metadata.SetupControllConnection(controlConnection);
            _binaryProtocolVersion = controlConnection.BinaryProtocolVersion;
            _logger.Info("Binary protocol version: [" + _binaryProtocolVersion + "]");
        }
Example #2
0
        private Cluster(IEnumerable<IPAddress> contactPoints, Configuration configuration)
        {
            _contactPoints = contactPoints;
            _configuration = configuration;
            _metadata = new Metadata(configuration.Policies.ReconnectionPolicy);

            var controlpolicies = new Policies(
                _configuration.Policies.LoadBalancingPolicy,
                new ExponentialReconnectionPolicy(2*1000, 5*60*1000),
                Policies.DefaultRetryPolicy);

            foreach (IPAddress ep in _contactPoints)
                Metadata.AddHost(ep);

            //Use 1 connection per host
            //The connection will be reused, it wont create a connection per host.
            var controlPoolingOptions = new PoolingOptions()
                .SetCoreConnectionsPerHost(HostDistance.Local, 1)
                .SetMaxConnectionsPerHost(HostDistance.Local, 1)
                .SetMinSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 0)
                .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 127);

            var controlConnection = new ControlConnection
                (this,
                new List<IPAddress>(),
                controlpolicies,
                new ProtocolOptions(_configuration.ProtocolOptions.Port, configuration.ProtocolOptions.SslOptions),
                controlPoolingOptions,
                _configuration.SocketOptions,
                new ClientOptions(true, _configuration.ClientOptions.QueryAbortTimeout, null),
                _configuration.AuthProvider,
                _configuration.AuthInfoProvider
                );

            _metadata.SetupControllConnection(controlConnection);
            _binaryProtocolVersion = controlConnection.ProtocolVersion;
            _logger.Info("Binary protocol version: [" + _binaryProtocolVersion + "]");
        }
Example #3
0
        private Cluster(IEnumerable<IPAddress> contactPoints, Configuration configuration)
        {
            this._contactPoints = contactPoints;
            this._configuration = configuration;
            this._metadata = new Metadata(configuration.Policies.ReconnectionPolicy);

            var controlpolicies = new Cassandra.Policies(
                _configuration.Policies.LoadBalancingPolicy,
                new ExponentialReconnectionPolicy(2 * 1000, 5 * 60 * 1000),
                Cassandra.Policies.DefaultRetryPolicy);

            foreach (var ep in _contactPoints)
                Metadata.AddHost(ep);

            var poolingOptions = new PoolingOptions().SetCoreConnectionsPerHost(HostDistance.Local, 1);

            var controlConnection = new ControlConnection(this, new List<IPAddress>(), controlpolicies,
                                                        new ProtocolOptions(_configuration.ProtocolOptions.Port),
                                                       poolingOptions, _configuration.SocketOptions,
                                                       new ClientOptions(
                                                           true,
                                                           _configuration.ClientOptions.QueryAbortTimeout, null,
                                                           _configuration.ClientOptions.AsyncCallAbortTimeout),
                                                       _configuration.AuthInfoProvider);

            _metadata.SetupControllConnection(controlConnection);
        }