/// <summary> /// Connect to a cluster /// </summary> /// <param name="providerName">Provider name is a unique name for the persistence layer /// type, for example: "redis"</param> /// <param name="config">Cluster config</param> /// <returns></returns> public static Unit connect( string providerName, ClusterConfig config) { var cluster = ClusterFactory.CreateCluster(providerName, config); cluster.Connect(); return ActorContext.RegisterCluster(cluster); }
/// <summary> /// Connect to a cluster /// </summary> /// <param name="providerName">Provider name is a unique name for the persistence layer /// type, for example: "redis"</param> /// <param name="config">Cluster config</param> public static ICluster connect( string providerName, ClusterConfig config) { var cluster = ClusterFactory.CreateCluster(providerName, config); cluster.Connect(); return cluster; }
/// <summary> /// Create a process cluster /// </summary> /// <param name="providerName"></param> /// <param name="config"></param> /// <returns>ICluster</returns> public static ICluster CreateCluster(string providerName, ClusterConfig config) { if (providerName == null) throw new ArgumentNullException(nameof(providerName)); if (config == null) throw new ArgumentNullException(nameof(config)); if (providers.ContainsKey(providerName)) { return providers[providerName](config); } else { throw new ArgumentException("'" + providerName + "' isn't a registered provider",nameof(providerName)); } }
/// <summary> /// Create a process cluster /// </summary> /// <param name="providerName"></param> /// <param name="config"></param> /// <returns>ICluster</returns> public static ICluster CreateCluster(string providerName, ClusterConfig config) { if (providerName == null) { throw new ArgumentNullException(nameof(providerName)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } if (providers.ContainsKey(providerName)) { return(providers[providerName](config)); } else { throw new ArgumentException($"'{providerName}' isn't a registered provider", nameof(providerName)); } }
/// <summary> /// ICluster factory provider /// </summary> /// <param name="config">ClusterConfig</param> /// <returns>ICluster</returns> private static ICluster factory(ClusterConfig config) { return new RedisClusterImpl(config); }
/// <summary> /// Ctor /// </summary> public RedisClusterImpl(ClusterConfig config) { this.config = config; }
/// <summary> /// ICluster factory provider /// </summary> /// <param name="config">ClusterConfig</param> /// <returns>ICluster</returns> private static ICluster factory(ClusterConfig config) { return(new RedisClusterImpl(config)); }