public SubscriptionConnection(TcpConnectionOptions connectionOptions) { TcpConnection = connectionOptions; ClientUri = connectionOptions.TcpClient.Client.RemoteEndPoint.ToString(); _logger = LoggingSource.Instance.GetLogger <SubscriptionConnection>(connectionOptions.DocumentDatabase.Name); CancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(TcpConnection.DocumentDatabase.DatabaseShutdown); _waitForMoreDocuments = new AsyncManualResetEvent(CancellationTokenSource.Token); Stats = new SubscriptionConnectionStats(); }
public SubscriptionConnection(TcpConnectionOptions connectionOptions) { TcpConnection = connectionOptions; _bufferedWriter = new BlittableJsonTextWriter(connectionOptions.Context, _buffer); _logger = LoggingSource.Instance.GetLogger <SubscriptionConnection>(connectionOptions.DocumentDatabase.Name); CancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(TcpConnection.DocumentDatabase.DatabaseShutdown); Stats = new SubscriptionConnectionStats(); TcpConnection.GetTypeSpecificStats = GetTypeSpecificStats; }
private static DynamicJsonValue GetConnectionStatsDJV(SubscriptionConnectionStats x) { return(new DynamicJsonValue() { [nameof(SubscriptionConnectionStats.AckRate)] = x.AckRate.CreateMeterData(), [nameof(SubscriptionConnectionStats.BytesRate)] = x.BytesRate.CreateMeterData(), [nameof(SubscriptionConnectionStats.ConnectedAt)] = x.ConnectedAt, [nameof(SubscriptionConnectionStats.DocsRate)] = x.DocsRate.CreateMeterData(), [nameof(SubscriptionConnectionStats.LastAckReceivedAt)] = x.LastAckReceivedAt, [nameof(SubscriptionConnectionStats.LastMessageSentAt)] = x.LastMessageSentAt, }); }
public SubscriptionConnection(TcpConnectionOptions connectionOptions, IDisposable tcpConnectionDisposable, JsonOperationContext.ManagedPinnedBuffer bufferToCopy) { TcpConnection = connectionOptions; _tcpConnectionDisposable = tcpConnectionDisposable; ClientUri = connectionOptions.TcpClient.Client.RemoteEndPoint.ToString(); _logger = LoggingSource.Instance.GetLogger <SubscriptionConnection>(connectionOptions.DocumentDatabase.Name); CancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(TcpConnection.DocumentDatabase.DatabaseShutdown); _waitForMoreDocuments = new AsyncManualResetEvent(CancellationTokenSource.Token); Stats = new SubscriptionConnectionStats(); _copiedBuffer = bufferToCopy.Clone(connectionOptions.ContextPool); }