示例#1
0
 /// <summary>
 /// Initializes a new instance of <see cref="EventEnvelope"/>
 /// </summary>
 /// <param name="sequenceNumber">The <see cref="EventSequenceNumber"/> for the <see cref="IEvent"/></param>
 /// <param name="correlationId">The <see cref="EventCorrelationId"/> for the <see cref="IEvent"/></param>
 /// <param name="origin">The <see cref="EventOrigin"/> for the <see cref="IEvent"/></param>
 /// <param name="event">The actual <see cref="IEvent"/></param>
 public EventEnvelope(
     EventSequenceNumber sequenceNumber,
     EventCorrelationId correlationId,
     EventOrigin origin,
     IEvent @event
     )
 {
     SequenceNumber = sequenceNumber;
     CorrelationId  = correlationId;
     Origin         = origin;
     Event          = @event;
 }
示例#2
0
        /// <inheritdoc/>
        public void Emit(Feature feature, IEnumerable <IEvent> events)
        {
            var origin = new EventOrigin(_applicationInformation.BoundedContext, feature);

            var envelopes = events.Select(@event => _eventEnvelopeProducer.CreateFor(origin, @event));

            _eventStore.Save(envelopes);

            Parallel.Invoke(
                () => _eventPublisher.Publish(envelopes),
                () => _eventProcessors.Process(envelopes)
                );
        }
示例#3
0
 /// <inheritdoc/>
 public EventEnvelope CreateFor(EventOrigin origin, IEvent @event)
 {
     return(new EventEnvelope(0, Guid.NewGuid(), origin, @event));
 }