Skip to content

Commit

Permalink
feat: or-2013 add correlationId to session
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu authored and janlesage committed Dec 20, 2023
1 parent 1e30b81 commit 6f388fe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AssociationRegistry/EventStore/EventStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ private static void TryLockForKboNumber(string vCode, IDocumentSession session,
session.Events.StartStream<KboNummer>(evnt.KboNummer, new { VCode = vCode });
}

private static StreamAction AppendEvents(IDocumentSession session, string aggregateId, IReadOnlyCollection<IEvent> events, long? expectedVersion)
private static StreamAction AppendEvents(
IDocumentSession session,
string aggregateId,
IReadOnlyCollection<IEvent> events,
long? expectedVersion)
{
if (expectedVersion is not null)
return session.Events.Append(stream: aggregateId, expectedVersion: expectedVersion.Value + events.Count, events: events);
return session.Events.Append(aggregateId, expectedVersion.Value + events.Count, events);

return session.Events.Append(aggregateId, events);
}
Expand All @@ -64,6 +68,7 @@ private static void SetHeaders(CommandMetadata metadata, IDocumentSession sessio
{
session.SetHeader(MetadataHeaderNames.Initiator, metadata.Initiator);
session.SetHeader(MetadataHeaderNames.Tijdstip, InstantPattern.General.Format(metadata.Tijdstip));
session.CorrelationId = metadata.CorrelationId.ToString();
}

private static bool IsEventFromDigitaalVlaanderen(Type eventType)
Expand Down

0 comments on commit 6f388fe

Please sign in to comment.