/// <inheritdoc/> public bool PassThrough(Processing.CommittedEventStreamWithContext committedEventStream) { if (!CanPassThrough(committedEventStream)) { return(false); } _tunnel.PassThrough(committedEventStream); return(true); }
void PassThroughSingularity(IEnumerable <Commits> commitsArray, ISingularity singularity) { commitsArray.ForEach(commits => { commits.ForEach(commit => { var committedEventStreamWithContext = new Processing.CommittedEventStreamWithContext(commit, commit.Events.First().Metadata.OriginalContext.ToExecutionContext(commit.CorrelationId)); if (singularity.CanPassThrough(committedEventStreamWithContext)) { singularity.PassThrough(committedEventStreamWithContext); } }); }); }
/// <inheritdoc/> public void PassThrough(Processing.CommittedEventStreamWithContext contextualEventStream) { try { var message = contextualEventStream.ToProtobuf(); _outbox.Enqueue(message); _waitHandle.Set(); } catch (Exception ex) { _logger.Error(ex, "Error creating and enqueueing committed event stream"); } }
/// <inheritdoc/> public void PassThrough(Processing.CommittedEventStreamWithContext committedEventStream) { lock (_singularities) { _logger.Information($"Committed eventstream entering event horizon with {_singularities.Count} singularities"); _singularities .Where(_ => _.CanPassThrough(committedEventStream)).AsParallel() .ForEach(_ => { _logger.Information($"Passing committed eventstream through singularity identified with bounded context '{_.BoundedContext}' in application '{_.Application}'"); _.PassThrough(committedEventStream); }); } }
/// <inheritdoc/> public bool CanPassThrough(Processing.CommittedEventStreamWithContext committedEventStream) { return(_subscription.Events.Any(_ => committedEventStream.EventStream.Events.Any(e => e.Metadata.Artifact == _))); }