IntegrationEventExtensions Class
Definition
- Namespace
- Savvyio.EventDriven
- Assemblies
- Savvyio.EventDriven.dll
Extension methods for the IIntegrationEvent interface.
public static class IntegrationEventExtensions
- Inheritance
-
IntegrationEventExtensions
Examples
Use IntegrationEventExtensions to read the event ID, timestamp, and member type from an integration event's metadata before publishing it to another subsystem.
using System;
using Savvyio.EventDriven;
namespace ExampleApp;
public sealed class IntegrationEventExtensionsExample
{
public (string EventId, DateTime Timestamp, string MemberType) Describe()
{
var e = new MemberCreatedEvent("MEM-42");
e.Metadata[Savvyio.MetadataDictionary.MemberType] = typeof(MemberCreatedEvent).FullName;
string eventId = e.GetEventId<MemberCreatedEvent>();
DateTime timestamp = e.GetTimestamp<MemberCreatedEvent>();
string memberType = e.GetMemberType<MemberCreatedEvent>();
Console.WriteLine($"Event {eventId} at {timestamp:O}, type: {memberType}");
return (eventId, timestamp, memberType);
}
}
public sealed record MemberCreatedEvent(string MemberId) : IntegrationEvent;
Methods
| Name | Description |
|---|---|
| GetEventId<T>(T) | Gets the string representation of the event identifier from the |
| GetMemberType<T>(T) | Gets the string representation of the type from the |
| GetTimestamp<T>(T) | Gets the DateTime value of the timestamp from the |