public async Task UpdateProjectionState(string projectionName, long position, CancellationToken cancellationToken) { var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken); if (projectionStateItem == null) { projectionStateItem = new ProjectionStateItem { Name = projectionName }; await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); } projectionStateItem.Position = position; }
public async Task SetErrorMessage(string projectionName, string?errorMessage, CancellationToken cancellationToken) { var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken); if (projectionStateItem == null) { projectionStateItem = new ProjectionStateItem { Name = projectionName, Position = -1L }; await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); } projectionStateItem.ErrorMessage = errorMessage; }
public async Task UpdateProjectionDesiredState(string projectionName, string desiredState, CancellationToken cancellationToken) { var projectionStateItem = await ProjectionStates.SingleOrDefaultAsync(item => item.Name == projectionName, cancellationToken); if (projectionStateItem == null) { projectionStateItem = new ProjectionStateItem { Name = projectionName, Position = -1L }; await ProjectionStates.AddAsync(projectionStateItem, cancellationToken); } projectionStateItem.DesiredState = desiredState; projectionStateItem.DesiredStateChangedAt = DateTimeOffset.UtcNow; }
public SyndicationStatusResponse(ProjectionStateItem projectionStateItem) { ProjectionName = projectionStateItem.Name; Position = projectionStateItem.Position; }