public EventStoreConnection(IPEndPoint tcpEndPoint, int maxConcurrentRequests = 50, int maxAttemptsForOperation = 10, int maxReconnections = 10, ILogger logger = null) { Ensure.NotNull(tcpEndPoint, "tcpEndPoint"); Ensure.Positive(maxConcurrentRequests, "maxConcurrentRequests"); Ensure.Nonnegative(maxAttemptsForOperation, "maxAttemptsForOperation"); Ensure.Nonnegative(maxReconnections, "maxReconnections"); _tcpEndPoint = tcpEndPoint; _maxConcurrentItems = maxConcurrentRequests; _maxAttempts = maxAttemptsForOperation; _maxReconnections = maxReconnections; LogManager.RegisterLogger(logger); _log = LogManager.GetLogger(); _connector = new TcpConnector(_tcpEndPoint); _subscriptionsChannel = new SubscriptionsChannel(_connector); //TODO TD: WAT? _projectionsManager = new ProjectionsManager(new IPEndPoint(_tcpEndPoint.Address, _tcpEndPoint.Port + 1000)); _lastReconnectionTimestamp = DateTime.UtcNow; _connection = _connector.CreateTcpConnection(OnPackageReceived, OnConnectionEstablished, OnConnectionClosed); _timeoutCheckStopwatch.Start(); _worker = new Thread(MainLoop) { IsBackground = true, Name = "Worker thread" }; _worker.Start(); }
private EventStoreConnection(bool allowForwarding, int maxConcurrentRequests, int maxAttemptsForOperation, int maxReconnections, ILogger logger) { _allowForwarding = allowForwarding; _maxConcurrentItems = maxConcurrentRequests; _maxAttempts = maxAttemptsForOperation; _maxReconnections = maxReconnections; LogManager.RegisterLogger(logger); _log = LogManager.GetLogger(); _connector = new TcpConnector(); _subscriptionsChannel = new SubscriptionsChannel(_connector); _projectionsManager = new ProjectionsManager(); }