private IEnumerable <RedisServerInfo> GetServers( RedisConnectionInfo connectionInfo, RedisConnectionInfo oldConnectionInfo = null) { if (oldConnectionInfo == null) { oldConnectionInfo = connectionInfo; } var targets = connectionInfo.ConnectionString.Split(';', ','); for (int i = 0; i < targets.Length; i++) { var parts = targets[i].Split(':'); var host = parts[0]; var port = int.Parse(parts[1]); var endpoint = new DnsEndPoint(host, port); var server = oldConnectionInfo.ServerInfos.FirstOrDefault( s => s.EndPoint.Host == endpoint.Host && s.EndPoint.Port == endpoint.Port); if (server != null) { yield return(new RedisServerInfo(server.Id, connectionInfo, endpoint)); } else { yield return(new RedisServerInfo(connectionInfo, endpoint)); } } }
public ConnectionNodeAction( Guid id, RedisConnectionInfo connectionInfo) { Id = id; ConnectionInfo = connectionInfo; }
private ConnectionNodeModel CreateConnectionNode(RedisConnectionInfo connectionInfo) { var node = new ConnectionNodeModel { ConnectionName = connectionInfo.Name, ConnectionString = connectionInfo.ConnectionString, ConnectionInfo = connectionInfo }; foreach (var server in connectionInfo.ServerInfos) { var serverNode = CreateServerNode(server); node.Nodes.Add(serverNode); } if (connectionInfo.DatabaseInfos.Count > 0) { var databaseGroupNode = CreateDatabaseGroupNode(connectionInfo); node.Nodes.Add(databaseGroupNode); } if (node.Nodes.Count > 0) { node.IsExpanded = true; node.IsOpen = true; } return(node); }
public Selected( RedisConnectionInfo connectionInfo, RedisServerInfo serverInfo, RedisDatabaseInfo databaseInfo) { ConnectionInfo = connectionInfo; ServerInfo = serverInfo; DatabaseInfo = databaseInfo; }
private void HandleUpdate(Guid id, RedisConnectionInfo connectionInfo) { var newConnectionNode = CreateConnectionNode(connectionInfo); var oldConnectionNode = _nodes.Items .OfType <ConnectionNodeModel>() .FirstOrDefault(node => node.ConnectionInfo.Id == id); _nodes.Replace(oldConnectionNode, newConnectionNode); }
public MockRedisForAccessTest(RedisConnectionInfo connectionInfo, Status statusGetA, Status statusModA, Status statusDelA) : base(connectionInfo) { _statusGetA = statusGetA; _statusModA = statusModA; _statusDelA = statusDelA; this.As.OnModifying += As_OnModifying; this.As.OnDeleting += As_OnDeleting; this.As.OnGetting += As_OnGetting; }
private DatabaseGroupNodeModel CreateDatabaseGroupNode(RedisConnectionInfo connectionInfo) { var node = new DatabaseGroupNodeModel(); foreach (var database in connectionInfo.DatabaseInfos) { var databaseNode = CreateDatabaseNode(database); node.Nodes.Add(databaseNode); } return(node); }
private ServerGroupNodeModel CreateServerGroupNode(RedisConnectionInfo connectionInfo) { var node = new ServerGroupNodeModel(); foreach (var server in connectionInfo.ServerInfos) { var serverNode = CreateServerNode(server); node.Nodes.Add(serverNode); } return(node); }
public IObservable <RedisConnectionInfo> Reconnect( RedisConnectionInfo oldConnectionInfo, string newConnectionName = null, string newConnectionString = null) { return(Observable.Return(GetConnection( newConnectionName ?? oldConnectionInfo.Name, newConnectionString ?? oldConnectionInfo.ConnectionString, oldConnectionInfo.Id)) .SelectMany(connectionInfo => { connectionInfo.ServerInfos.AddRange(GetServers(connectionInfo, oldConnectionInfo)); return connectionInfo.ServerInfos .ToObservable() .SelectMany(s => { return _clientAccessor.Init(s) .Catch <RedisClient, Exception>( e => Observable.Return(default(RedisClient))); }) .ToList() .Select(clients => { if (clients.Any(c => c.IsConnected)) { connectionInfo.DatabaseInfos.AddRange(GetDatabases(connectionInfo, oldConnectionInfo)); } else { connectionInfo.ServerInfos.Clear(); } return connectionInfo; }); }) .Do(async connectionInfo => { int i = _connectionRegistry.IndexOf(oldConnectionInfo); _connectionRegistry[i] = connectionInfo; await _connectionStorage.UpdateAsync(new ConnectionEntity { Id = oldConnectionInfo.Id, Name = newConnectionName ?? oldConnectionInfo.Name, ConnectionString = newConnectionString ?? oldConnectionInfo.ConnectionString }); _broadcastService.Broadcast( new ConnectionBroadcast(connectionInfo.Id, ConnectionBroadcastKind.Reconnect)); })); }
private ConnectionItemModel CreateConnectionItem( RedisConnectionInfo connectionInfo) { var connectionName = string.IsNullOrWhiteSpace(connectionInfo.Name) ? connectionInfo.ConnectionString : connectionInfo.Name; var connectionString = string.IsNullOrWhiteSpace(connectionInfo.Name) ? null : $"({connectionInfo.ConnectionString})"; return(new ConnectionItemModel { ConnectionString = connectionString, ConnectionName = connectionName, ConnectionInfo = connectionInfo }); }
public IObservable <RedisConnectionInfo> Disconnect( RedisConnectionInfo oldConnectionInfo) { return(oldConnectionInfo.ServerInfos .ToObservable() .ToList() .SelectMany(serverInfos => { return serverInfos .ToObservable() .SelectMany(s => _clientAccessor.Release(s)) .ToList(); }) .Select(_ => { _broadcastService.Broadcast( new ConnectionBroadcast(oldConnectionInfo.Id, ConnectionBroadcastKind.Disconnect)); return oldConnectionInfo; })); }
private IEnumerable <RedisDatabaseInfo> GetDatabases( RedisConnectionInfo connectionInfo, RedisConnectionInfo oldConnectionInfo = null) { if (oldConnectionInfo == null) { oldConnectionInfo = connectionInfo; } for (int i = 0; i < 16; i++) { if (i < oldConnectionInfo.DatabaseInfos.Count) { yield return(new RedisDatabaseInfo( oldConnectionInfo.DatabaseInfos[i].Id, connectionInfo, i)); } else { yield return(new RedisDatabaseInfo( connectionInfo, i)); } } }
public IObservable <RedisConnectionInfo> Close( RedisConnectionInfo oldConnectionInfo) { return(oldConnectionInfo.ServerInfos .ToObservable() .ToList() .SelectMany(serverInfos => { return serverInfos .ToObservable() .SelectMany(s => _clientAccessor.Release(s)) .ToList(); }) .Do(async _ => { _connectionRegistry.Remove(oldConnectionInfo); await _connectionStorage.RemoveAsync(oldConnectionInfo.Id); _broadcastService.Broadcast( new ConnectionBroadcast(oldConnectionInfo.Id, ConnectionBroadcastKind.Close)); }) .Select(_ => oldConnectionInfo)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RedisConnectionInfo redisInfo = Settings.Current.RedisConnectionInfo; if (Settings.Current.EnableSignalR && redisInfo != null) { var config = new RedisScaleoutConfiguration(redisInfo.Host, redisInfo.Port, redisInfo.Password, "exceptionless.signalr"); GlobalHost.DependencyResolver.UseRedis(config); } GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); AuthConfig.RegisterAuth(); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.CreateMappings(); Trace.Listeners.Add(new NLogTraceListener()); if (ExceptionlessClient.Current.Configuration.Enabled) { ExceptionlessClient.Current.Log = new NLogExceptionlessLog(); ExceptionlessClient.Current.RegisterWebApi(GlobalConfiguration.Configuration); ExceptionlessClient.Current.UnhandledExceptionReporting += CurrentOnUnhandledExceptionReporting; } // startup the message queue JobManager.Current.JobManagerStarted += (sender, args) => JobManager.Current.RunJob("StartMq"); // make the notification sender listen for messages var notificationSender = DependencyResolver.Current.GetService <NotificationSender>(); notificationSender.Listen(); }
public ConnectDialogModel(RedisConnectionInfo connectionInfo) : this() { ConnectionInfo = connectionInfo; }
public Add(Guid id, RedisConnectionInfo connectionInfo) : base(id, connectionInfo) { }
public Update(Guid id, RedisConnectionInfo connectionInfo) : base(id, connectionInfo) { }
private void HandleAdd(RedisConnectionInfo connectionInfo) { var connectionNode = CreateConnectionNode(connectionInfo); _nodes.Insert(_nodes.Count - 1, connectionNode); }
public MockRedisContext(RedisConnectionInfo connectionInfo) : base(connectionInfo) { }
public Created(RedisConnectionInfo connectionInfo) { ConnectionInfo = connectionInfo; }