Class EventStreamTypeAttribute
- Namespace
- Cratis.Chronicle.Events
- Assembly
- Cratis.Chronicle.dll
Attribute to specify the EventStreamType for a command, an observer or an aggregate root.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
public sealed class EventStreamTypeAttribute : Attribute
- Inheritance
-
EventStreamTypeAttribute
- Inherited Members
- Extension Methods
Remarks
When applied to an observer (reactor or reducer), it filters observed events to only
those belonging to the given event stream type. When applied to a command, setting
concurrency to true includes this value in the concurrency
scope when appending events. When applied to an aggregate root, it becomes the event stream type of every
event that aggregate appends; without it the aggregate's own type name is used, so removing the attribute
moves every subsequent append to a different stream type without any signal that it did.
A projection is not one of them. It observes every event of the types its definition declares, and cannot filter on event metadata at all - there is no field for a filter anywhere in a projection's definition, so no client can express one and no kernel could honour it. Narrow a projection by the event types it declares, or pair it with a reactor or reducer that owns the filtered subset. See Documentation/projections/filtering.
Neither is an event type. An append resolves its EventStreamType from the arguments it is given, never from the CLR type of the event being appended, so the attribute placed on an event type is read by nothing and reaches no appended event's context. Declare it on the command that appends the event, on the reactor or reducer that observes it, or on the aggregate root whose appends it identifies.
Constructors
EventStreamTypeAttribute(string, bool)
Attribute to specify the EventStreamType for a command, an observer or an aggregate root.
public EventStreamTypeAttribute(string value, bool concurrency = false)
Parameters
valuestringThe EventStreamType value.
concurrencyboolWhether to include this metadata in the concurrency scope when appending events. Default is false.
Remarks
When applied to an observer (reactor or reducer), it filters observed events to only
those belonging to the given event stream type. When applied to a command, setting
concurrency to true includes this value in the concurrency
scope when appending events. When applied to an aggregate root, it becomes the event stream type of every
event that aggregate appends; without it the aggregate's own type name is used, so removing the attribute
moves every subsequent append to a different stream type without any signal that it did.
A projection is not one of them. It observes every event of the types its definition declares, and cannot filter on event metadata at all - there is no field for a filter anywhere in a projection's definition, so no client can express one and no kernel could honour it. Narrow a projection by the event types it declares, or pair it with a reactor or reducer that owns the filtered subset. See Documentation/projections/filtering.
Neither is an event type. An append resolves its EventStreamType from the arguments it is given, never from the CLR type of the event being appended, so the attribute placed on an event type is read by nothing and reaches no appended event's context. Declare it on the command that appends the event, on the reactor or reducer that observes it, or on the aggregate root whose appends it identifies.
Properties
Concurrency
Gets a value indicating whether this metadata should be included in the concurrency scope.
public bool Concurrency { get; }
Property Value
EventStreamType
Gets the EventStreamType.
public EventStreamType EventStreamType { get; }