Ejemplo n.º 1
0
        public RedisBusDataStore(IOptions <EndpointsConfig> endpointsConfig)
        {
            if (endpointsConfig == null)
            {
                throw new ArgumentNullException(nameof(endpointsConfig));
            }

            _endpointsConfig = endpointsConfig.Value;
            RedisConnectorHelper.RedisEndpoint = _endpointsConfig.Redis;
            _redisDatabase = RedisConnectorHelper.Connection.GetDatabase();
        }
Ejemplo n.º 2
0
        // https://www.codeproject.com/Articles/758803/DotNet-Programming-using-Cassandra
        public static ICluster GetCluster(int myPort, string[] myClusters)
        {
            CassandraSharpConfig config        = new CassandraSharpConfig();
            ClusterConfig        clusterConfig = new ClusterConfig();
            TransportConfig      transConfig   = new TransportConfig();

            clusterConfig.Name      = "Test Cluster";
            transConfig.Port        = myPort;
            clusterConfig.Transport = new TransportConfig();

            EndpointsConfig endPointConfig = new EndpointsConfig();

            endPointConfig.Servers = myClusters;
            // endPointConfig.Snitch = SnitchType.Simple;
            // endPointConfig.Strategy = EndpointStrategy.Nearest;

            //BehaviorConfig behaveConfig = new BehaviorConfig();
            //behaveConfig.KeySpace = ConfigEntries.DefaultDatabase;
            //if (!String.IsNullOrWhiteSpace(ConfigEntries.UserName)) behaveConfig.User = ConfigEntries.UserName;
            //if (!String.IsNullOrWhiteSpace(ConfigEntries.Password)) behaveConfig.Password = ConfigEntries.Password;
            //behaveConfig.ReadConsistencyLevel = Apache.Cassandra.ConsistencyLevel.ONE;
            //behaveConfig.WriteConsistencyLevel = Apache.Cassandra.ConsistencyLevel.ONE;

            clusterConfig.Transport = transConfig;
            clusterConfig.Endpoints = endPointConfig;


            // KeyspaceConfig ksc = new KeyspaceConfig();
            // ksc.Name = "";

            // clusterConfig.DefaultKeyspace = ksc;



            config.Clusters = new ClusterConfig[] { clusterConfig };

            //We need to ensure that the connection is not initialized before configuring...
            ClusterManager.Shutdown();

            ClusterManager.Configure(config);

            ICluster cluster = ClusterManager.GetCluster("Test Cluster");

            return(cluster);
        }
Ejemplo n.º 3
0
 public ValuesController(IOptions <EndpointsConfig> endpointsConfig)
 {
     _endpointsConfig = endpointsConfig.Value;
 }