public IncomingInvocationDescriptor( InvocationMethodDescriptor method, AppConnectionDescriptor source) { Method = method; Source = source; }
public void AppConnected(AppConnectionDescriptor appConnection) { _bindingSubject.OnNext(new AppContextBindingEvent(this, appConnection.ApplicationInstanceId)); var appConnectionsSet = GetOrCreateAppConnectionsSet(appConnection.ApplicationInstanceId); appConnectionsSet.AppConnected(appConnection); }
public AppConnection(ITransportConnection connection, AppConnectionDescriptor appInfo) { Id = connection.Id; _log = LogManager.GetLogger <AppConnection>(Id.ToString()); Info = appInfo; _connection = connection; Completion = ProcessAsync(); }
public static Generated.AppConnectionDescriptor ToProto(this AppConnectionDescriptor info) { return(new Generated.AppConnectionDescriptor { AppId = info.ApplicationId, AppInstanceId = info.ApplicationInstanceId.ToProto(), ConnectionId = info.ConnectionId.ToProto() }); }
public void AppDisconnected(AppConnectionDescriptor appConnection) { lock (_lock) { if (_appInstanceIdsToConnections.TryGetValue(appConnection.ApplicationInstanceId, out var appConnectionsSet)) { appConnectionsSet.AppDisconnected(appConnection); } } }
public InvocationDescriptor( AppConnectionDescriptor sourceConnection, AppConnectionDescriptor targetConnection, string serviceId, string serviceAlias, string methodId) { SourceConnection = sourceConnection; TargetConnection = targetConnection; ServiceId = serviceId; ServiceAlias = serviceAlias; MethodId = methodId; }
public void AppDisconnected(AppConnectionDescriptor appConnection) { var updated = false; lock (_lock) { var appId = appConnection.ApplicationId; updated |= _appConnectionMap.Remove(appId); updated |= _loadingApps.Remove(appId); } if (updated) { _updatedSubject.OnNext(Unit.Default); } }
public async Task <IAppConnection> HandleAsync(ITransportConnection connection) { Log.Trace("Accepting new connection {0}", connection.Id); var channel = await connection.IncomingChannels.ReadAsync().ConfigureAwait(false); var frame = await channel.In.ReadAsync().ConfigureAwait(false); using (var payload = frame.Payload) using (var connectRequest = _serializer.DeserializeConnectRequest(payload)) { if (!_registryService.IsApplicationDefined(connectRequest.ApplicationId)) { throw new BrokerException($"Connection rejected because application id is unknown to broker: {connectRequest.ApplicationId}"); } using (var connectResponse = _messageFactory.CreateConnectResponse(connection.Id)) { var serializedResponse = _serializer.Serialize(connectResponse); try { Log.Trace("Sending connect response ({0} bytes): {1}", connectResponse, serializedResponse.Count); await channel.Out.WriteAsync(new TransportMessageFrame(serializedResponse)).ConfigureAwait(false); } catch { serializedResponse.Dispose(); throw; } channel.Out.TryComplete(); await channel.Completion.ConfigureAwait(false); var info = new AppConnectionDescriptor( connectResponse.ConnectionId, connectRequest.ApplicationId, connectRequest.ApplicationInstanceId); var clientConnection = _connectionTracker.AcceptConnection(connection, info); Log.Info("New connection accepted: {0}", clientConnection); return(clientConnection); } } }
public void AppConnected(AppConnectionDescriptor appConnection) { var updated = false; lock (_lock) { var appId = appConnection.ApplicationId; if (!_appConnectionMap.TryGetValue(appId, out var existingAppConnection) || !Equals(appConnection, existingAppConnection)) { _appConnectionMap[appId] = appConnection; updated = true; } updated |= _loadingApps.Remove(appId); } if (updated) { _updatedSubject.OnNext(Unit.Default); } }
public AppConnectionEvent(AppConnectionDescriptor connection, ConnectionEventType type) { Connection = connection; Type = type; }