public void ExecuteOperation(OperationItem operation, TcpPackageConnection connection) { operation.ConnectionId = connection.ConnectionId; operation.LastUpdated = DateTime.UtcNow; _activeOperations.Add(operation.CorrelationId, operation); var package = operation.Operation.CreateNetworkPackage(operation.CorrelationId); LogDebug("ExecuteOperation package {0}, {1}, {2}.", package.Command, package.CorrelationId, operation); connection.EnqueueSend(package); }
public bool RemoveOperation(OperationItem operation) { if (!_activeOperations.Remove(operation.CorrelationId)) { LogDebug("RemoveOperation FAILED for {0}", operation); return(false); } LogDebug("RemoveOperation SUCCEEDED for {0}", operation); _totalOperationCount = _activeOperations.Count + _waitingOperations.Count; return(true); }
bool TryExpireItem(DateTime cutoffDate, OperationItem operation) { if (operation.CreatedTime > cutoffDate) { return(false); } var err = string.Format("EventStoreConnection '{0}': request expired.\n" + "UTC now: {1:HH:mm:ss.fff}, operation: {2}.", _connectionName, DateTime.UtcNow, operation); _settings.Log.Debug(err); operation.Operation.Fail(new OperationExpiredException(err)); return(true); }
public void ScheduleOperationRetry(OperationItem operation) { if (!RemoveOperation(operation)) { return; } LogDebug("ScheduleOperationRetry for {0}", operation); if (operation.MaxRetries >= 0 && operation.RetryCount >= operation.MaxRetries) { operation.Operation.Fail(new RetriesLimitReachedException(operation.ToString(), operation.RetryCount)); return; } _retryPendingOperations.Add(operation); }
public void ScheduleOperation(OperationItem operation, TcpPackageConnection connection) { Ensure.NotNull(connection, "connection"); if (_activeOperations.Count >= _settings.MaxConcurrentItems) { LogDebug("ScheduleOperation WAITING for {0}.", operation); _waitingOperations.Enqueue(operation); } else { operation.ConnectionId = connection.ConnectionId; operation.LastUpdated = DateTime.UtcNow; _activeOperations.Add(operation.CorrelationId, operation); var package = operation.Operation.CreateNetworkPackage(operation.CorrelationId); LogDebug("ScheduleOperation package {0}, {1}, {2}.", package.Command, package.CorrelationId, operation); connection.EnqueueSend(package); } _totalOperationCount = _activeOperations.Count + _waitingOperations.Count; }
public bool TryGetActiveOperation(Guid correlationId, out OperationItem operation) { return(_activeOperations.TryGetValue(correlationId, out operation)); }
public void ScheduleOperation(OperationItem operation, TcpPackageConnection connection) { Ensure.NotNull(connection, "connection"); _waitingOperations.Enqueue(operation); TryScheduleWaitingOperations(connection); }
public void EnqueueOperation(OperationItem operation) { LogDebug("EnqueueOperation WAITING for {0}.", operation); _waitingOperations.Enqueue(operation); }