public SessionSettings(Config config) { if (config == null) throw new ArgumentNullException("config"); Builder = Cluster.Builder(); // Get IP and port configuration int port = config.GetInt("port", 9042); IPEndPoint[] contactPoints = ParseContactPoints(config.GetStringList("contact-points"), port); Builder.AddContactPoints(contactPoints); // Support user/pass authentication if (config.HasPath("credentials")) Builder.WithCredentials(config.GetString("credentials.username"), config.GetString("credentials.password")); // Support SSL if (config.GetBoolean("ssl")) Builder.WithSSL(); // Support compression string compressionTypeConfig = config.GetString("compression"); if (compressionTypeConfig != null) { var compressionType = (CompressionType) Enum.Parse(typeof (CompressionType), compressionTypeConfig, true); Builder.WithCompression(compressionType); } }
public static void Build(Builder builder) { if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Console.WriteLine("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Console.WriteLine("No buffering"); } Cluster = builder.AddContactPoints(Options.Default.IP_PREFIX + "1").Build(); }
public static Cluster Build(Builder builder) { if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Trace.TraceInformation("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Trace.TraceInformation("No buffering"); } Cluster = builder.AddContactPoints(Options.Default.IP_PREFIX + "1").Build(); return(Cluster); }
private CCMCluster(CCMBridge ccmBridge, Builder builder) { int tryNo = 0; builder.AddContactPoints(Options.Default.IP_PREFIX + "1"); if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Console.WriteLine("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Console.WriteLine("No buffering"); } this.Cluster = builder.Build(); RETRY: this.CCMBridge = ccmBridge; try { this.Session = Cluster.Connect(); if (tryNo > 0) { Cluster.RefreshSchema(); } } catch (NoHostAvailableException e) { if (tryNo < 10) { Console.WriteLine("CannotConnect to CCM node - give another try"); tryNo++; Thread.Sleep(1000); goto RETRY; } foreach (var entry in e.Errors) { Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value); } throw new InvalidOperationException(null, e); } }
public static void Build(Builder builder) { if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Console.WriteLine("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Console.WriteLine("No buffering"); } Cluster = builder.AddContactPoints(Options.Default.IP_PREFIX + "1").Build(); }
private CCMCluster(CCMBridge ccmBridge, Builder builder) { int tryNo = 0; builder.AddContactPoints(Options.Default.IP_PREFIX + "1"); if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Console.WriteLine("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Console.WriteLine("No buffering"); } this.Cluster = builder.Build(); RETRY: this.CCMBridge = ccmBridge; try { this.Session = Cluster.Connect(); if(tryNo>0) Cluster.RefreshSchema(); } catch (NoHostAvailableException e) { if (tryNo < 10) { Console.WriteLine("CannotConnect to CCM node - give another try"); tryNo++; Thread.Sleep(1000); goto RETRY; } foreach (var entry in e.Errors) Trace.TraceError("Error connecting to " + entry.Key + ": " + entry.Value); throw new InvalidOperationException(null, e); } }
public static Cluster Build(Builder builder) { if (Options.Default.USE_COMPRESSION) { builder.WithCompression(CompressionType.Snappy); Trace.TraceInformation("Using Compression"); } if (Options.Default.USE_NOBUFFERING) { builder.WithoutRowSetBuffering(); Trace.TraceInformation("No buffering"); } Cluster = builder.AddContactPoints(Options.Default.IP_PREFIX + "1").Build(); return Cluster; }