Ejemplo n.º 1
0
        /// <summary>
        /// Convert from <see cref="Dolittle.Runtime.Events.Processing.CommittedEventStreamWithContext"/> to <see cref="Protobuf.CommittedEventStream"/>
        /// </summary>
        /// <param name="contextualEventStream"><see cref="Dolittle.Runtime.Events.Processing.CommittedEventStreamWithContext"/> to convert from</param>
        /// <returns>Converted <see cref="Protobuf.CommittedEventStream"/></returns>
        public static CommittedEventStreamWithContext ToProtobuf(this Dolittle.Runtime.Events.Processing.CommittedEventStreamWithContext contextualEventStream)
        {
            var protobuf = new CommittedEventStreamWithContext
            {
                Commit  = contextualEventStream.EventStream.ToProtobuf(),
                Context = contextualEventStream.Context.ToProtobuf()
            };

            return(protobuf);
        }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public void PassThrough(Dolittle.Runtime.Events.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");
     }
 }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 public void PassThrough(Dolittle.Runtime.Events.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);
         });
     }
 }