Skip to content

Commit

Permalink
fix: add StreamId to Envelope Metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored and ArneD committed Nov 30, 2023
1 parent fb9481b commit 23a5dd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class Envelope<TMessage> // Used by handlers

public TMessage Message => (TMessage)_envelope.Message;

public string StreamId => (string)_envelope.Metadata[Envelope.StreamIdMetadataKey];

public long Position => (long)_envelope.Metadata[Envelope.PositionMetadataKey];

public string EventName => (string)_envelope.Metadata[Envelope.EventNameMetadataKey];
Expand All @@ -29,6 +31,7 @@ public Envelope(Envelope envelope) =>

public class Envelope // Used by dispatchers
{
public const string StreamIdMetadataKey = "StreamId";
public const string PositionMetadataKey = "Position";
public const string EventNameMetadataKey = "EventName";
public const string CreatedUtcMetadataKey = "CreatedUtc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public object Create(StreamMessage message)
? new Dictionary<string, object>(deserializedMetadata, StringComparer.OrdinalIgnoreCase)
: new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);

metadata[Envelope.StreamIdMetadataKey] = message.StreamId;
metadata[Envelope.PositionMetadataKey] = message.Position;
metadata[Envelope.EventNameMetadataKey] = message.Type;
metadata[Envelope.CreatedUtcMetadataKey] = message.CreatedUtc;
Expand Down

0 comments on commit 23a5dd9

Please sign in to comment.