Interface IEventStorageRecord
interface for implementing an event storage record that encapsulates/embeds an event (IEvent)
Namespace: FastEndpoints
Assembly: FastEndpoints.Messaging.Remote.dll
Syntax
public interface IEventStorageRecord
Properties
Event
the actual event object that will be embedded in the storage record. if your database/orm (such as ef-core) doesn't support embedding objects, you can take the following steps:
1. add a [NotMapped] attribute to this property.
2. add a new property, either a string or array
3. implement both and to serialize/deserialize the event object back and forth and store it in the newly added property.
you may use any serializer you please. recommendation is to use MessagePack.
Declaration
object Event { get; set; }
Property Value
Type | Description |
---|---|
object |
EventType
the full type name of the event
Declaration
string EventType { get; set; }
Property Value
Type | Description |
---|---|
string |
ExpireOn
the expiration date/time of the event. this is used to purge stale records. default value is 4 hours from time of creation.
Declaration
DateTime ExpireOn { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
IsComplete
pending status of the event. will only return true if the event has been successfully processed and is ready to be discarded.
Declaration
bool IsComplete { get; set; }
Property Value
Type | Description |
---|---|
bool |
SubscriberID
a subscriber id is a unique identifier of an event stream subscriber on a remote node. it is a unique id per each event handler type (TEvent+TEventHandler combo). you don't have to worry about generating this as it will automatically be set by the library.
Declaration
string SubscriberID { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
GetEvent<TEvent>()
implement this function to customize event deserialization.
Declaration
TEvent GetEvent<TEvent>() where TEvent : IEvent
Returns
Type | Description |
---|---|
TEvent |
Type Parameters
Name | Description |
---|---|
TEvent |
SetEvent<TEvent>(TEvent)
implement this method to customize event serialization.
Declaration
void SetEvent<TEvent>(TEvent @event) where TEvent : IEvent
Parameters
Type | Name | Description |
---|---|---|
TEvent | event |
Type Parameters
Name | Description |
---|---|
TEvent |