Beispiel #1
0
        private Event Serialize(ISerializedEvent serializedEvent)
        {
            var eventData = BsonDocument.Parse(serializedEvent.SerializedData);
            var metadata  = BsonDocument.Parse(serializedEvent.SerializedMetadata);
            var id        = serializedEvent.Metadata.GetValue(MetadataKeys.EventId, value => Guid.Parse(value.ToString()));
            var eventType = serializedEvent.Metadata.GetValue(MetadataKeys.EventName, value => value.ToString());

            var @event = new Event
            {
                Id          = id,
                Timestamp   = DateTime.UtcNow,
                EventType   = eventType,
                AggregateId = serializedEvent.AggregateId,
                Version     = serializedEvent.Version,
                EventData   = eventData,
                Metadata    = metadata
            };

            return(@event);
        }
 private static ICommitedEvent InstantiateCommitedEvent(ISerializedEvent serializedEvent)
 {
     return(new InMemoryCommitedEvent(serializedEvent.AggregateId, serializedEvent.Version, serializedEvent.SerializedData, serializedEvent.SerializedMetadata));
 }
Beispiel #3
0
 public void EnqueueEvent(ISerializedEvent evt)
 {
     events.Enqueue(evt);
 }