/// <summary> /// Converts the <see cref="CommittedEvent" /> to <see cref="Events.Contracts.CommittedEvent" />. /// </summary> /// <param name="event">The <see cref="CommittedEvent" />.</param> /// <returns>The <see cref="Events.Contracts.CommittedEvent" />.</returns> public static Events.Contracts.CommittedEvent ToCommittedEventHorizonEvent(this CommittedEvent @event) { var committedEvent = @event.ToProtobuf(); committedEvent.ExecutionContext.Claims.Clear(); committedEvent.ExecutionContext.Claims.AddRange(Claims.Empty.ToProtobuf()); return(committedEvent); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, ExecutionContext executionContext, CancellationToken cancellationToken) { var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf() }; return(Filter(request, executionContext, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, CancellationToken cancellationToken) { _logger.Debug("Filter event that occurred @ {Occurred}", @event.Occurred); var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf() }; return(Filter(request, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, ExecutionContext executionContext, CancellationToken cancellationToken) { var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf(), RetryProcessingState = new RetryProcessingState { FailureReason = failureReason, RetryCount = retryCount } }; return(Filter(request, executionContext, cancellationToken)); }
/// <inheritdoc /> public Task <IProcessingResult> Process(CommittedEvent @event, PartitionId partitionId, ExecutionContext executionContext, CancellationToken cancellationToken) { _logger.EventProcessorIsProcessing(Identifier, @event.Type.Id, partitionId); var request = new HandleEventRequest { Event = new Contracts.StreamEvent { Event = @event.ToProtobuf(), PartitionId = partitionId.Value, ScopeId = Scope.ToProtobuf() }, }; return(Process(request, executionContext, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, ExecutionContext executionContext, CancellationToken cancellationToken) { if ([email protected]) { return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, PartitionId.None))); } var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf() }; return(Filter(request, executionContext, cancellationToken)); }
/// <inheritdoc/> public Task <IProcessingResult> Process(CommittedEvent @event, PartitionId partitionId, string failureReason, uint retryCount, ExecutionContext executionContext, CancellationToken cancellationToken) { _logger.EventProcessorIsProcessingAgain(Identifier, @event.Type.Id, partitionId, retryCount, failureReason); var request = new HandleEventRequest { Event = new Contracts.StreamEvent { Event = @event.ToProtobuf(), PartitionId = partitionId.Value, ScopeId = Scope.ToProtobuf() }, RetryProcessingState = new RetryProcessingState { FailureReason = failureReason, RetryCount = retryCount } }; return(Process(request, executionContext, cancellationToken)); }
async Task <IProjectionResult> Process(ProjectionCurrentState state, CommittedEvent @event, PartitionId partitionId, ProjectionRequest request, ExecutionContext executionContext, CancellationToken token) { request.Event = new Contracts.StreamEvent { Event = @event.ToProtobuf(), PartitionId = partitionId.Value, ScopeId = Definition.Scope.ToProtobuf(), }; request.CurrentState = state.ToProtobuf(); var response = await _dispatcher.Call(request, executionContext, token).ConfigureAwait(false); return(response switch { { Failure : null, ResponseCase : ProjectionResponse.ResponseOneofCase.Replace } => new ProjectionReplaceResult(response.Replace.State),
/// <inheritdoc /> public Task <IProcessingResult> Process(CommittedEvent @event, PartitionId partitionId, CancellationToken cancellationToken) { _logger.Debug( "{LogMessagePrefix} is processing event '{EventTypeId}' for partition '{PartitionId}'", _logMessagePrefix, @event.Type.Id.Value, partitionId.Value); var request = new HandleEventRequest { Event = new Contracts.StreamEvent { Event = @event.ToProtobuf(), PartitionId = partitionId.ToProtobuf(), ScopeId = Scope.ToProtobuf() }, }; return(Process(request, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, CancellationToken cancellationToken) { _logger.Debug( "Filter event that occurred @ {Occurred} to public events stream '{TargetStream}'", @event.Occurred, Definition.TargetStream); if ([email protected]) { return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, Guid.Empty))); } var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf() }; return(Filter(request, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, CancellationToken cancellationToken) { _logger.Debug( "Filter event that occurred @ {Occurred} again for the {RetryCount}. time because: {FailureReason}", @event.Occurred, retryCount, failureReason); var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf(), RetryProcessingState = new RetryProcessingState { FailureReason = failureReason, RetryCount = retryCount } }; return(Filter(request, cancellationToken)); }
/// <inheritdoc/> public Task <IProcessingResult> Process(CommittedEvent @event, PartitionId partitionId, string failureReason, uint retryCount, CancellationToken cancellationToken) { _logger.Debug( "{LogMessagePrefix} is processing event '{EventTypeId}' for partition '{PartitionId}' again for the {RetryCount}. time because: {FailureReason}", _logMessagePrefix, @event.Type.Id.Value, partitionId.Value, retryCount, failureReason); var request = new HandleEventRequest { Event = new Contracts.StreamEvent { Event = @event.ToProtobuf(), PartitionId = partitionId.ToProtobuf(), ScopeId = Scope.ToProtobuf() }, RetryProcessingState = new RetryProcessingState { FailureReason = failureReason, RetryCount = retryCount } }; return(Process(request, cancellationToken)); }
/// <inheritdoc/> public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, CancellationToken cancellationToken) { _logger.Debug( "Filter event that occurred @ {Occurred} to public events stream '{TargetStream}' again for the {RetryCount}. time because: {FailureReason}", @event.Occurred, Definition.TargetStream, retryCount, failureReason); if ([email protected]) { return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, Guid.Empty))); } var request = new FilterEventRequest { Event = @event.ToProtobuf(), ScopeId = Scope.ToProtobuf(), RetryProcessingState = new RetryProcessingState { FailureReason = failureReason, RetryCount = retryCount } }; return(Filter(request, cancellationToken)); }