-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEVEX-222] Added message type maps registration
- Loading branch information
1 parent
1e65b62
commit b395583
Showing
7 changed files
with
92 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using EventStore.Client; | ||
|
||
namespace Kurrent.Client.Core.Serialization; | ||
|
||
public readonly struct Message { | ||
/// <summary> | ||
/// The raw bytes of the event data. | ||
/// </summary> | ||
public readonly object Data; | ||
|
||
/// <summary> | ||
/// The raw bytes of the event metadata. | ||
/// </summary> | ||
public readonly object? Metadata; | ||
|
||
/// <summary> | ||
/// The <see cref="Uuid"/> of the event, used as part of the idempotent write check. | ||
/// </summary> | ||
public readonly Uuid EventId; | ||
|
||
/// <summary> | ||
/// Constructs a new <see cref="Message"/>. | ||
/// </summary> | ||
/// <param name="data">The raw bytes of the event data.</param> | ||
/// <param name="metadata">The raw bytes of the event metadata.</param> | ||
/// <param name="eventId">The <see cref="Uuid"/> of the event, used as part of the idempotent write check.</param> | ||
/// <exception cref="ArgumentOutOfRangeException"></exception> | ||
public Message(object data, object? metadata = null, Uuid? eventId = null) { | ||
if (eventId == Uuid.Empty) | ||
throw new ArgumentOutOfRangeException(nameof(eventId)); | ||
|
||
EventId = eventId ?? Uuid.NewUuid(); | ||
Data = data; | ||
Metadata = metadata; | ||
} | ||
|
||
public void Deconstruct(out object data, out object? metadata, out Uuid eventId) { | ||
data = Data; | ||
metadata = Metadata; | ||
eventId = EventId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters