Annotations
@EventType
Section titled “@EventType”Marks a data class as a Chronicle event type.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
generation | Int | 1 | Schema version. Increment when shape changes. |
tombstone | Boolean | false | Signals event source retirement. |
@EventTypedata class OrderPlaced(val orderId: String, val totalAmount: Double)Omitting id is the common case — Chronicle uses OrderPlaced as the
identifier automatically.
@Reactor
Section titled “@Reactor”Marks a class as a Chronicle reactor. Each public method becomes a handler for the event type of its first parameter.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
@Reactorclass OrderNotifications { ... }Supply an explicit id only when you need the identifier to survive class renames.
@Reducer
Section titled “@Reducer”Marks a class as a reducer. Each public method folds one event type into the read model.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
@Reducerclass OrderSummaryReducer { ... }@ReadModel
Section titled “@ReadModel”Marks a data class as a Chronicle read model.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
displayName | String | "" | Human-readable label. Defaults to name. |
@ReadModeldata class OrderSummary(val orderId: String = "", val status: String = "pending")@Projection
Section titled “@Projection”Marks a class as a Chronicle projection. The class must implement
IProjectionFor<T> or be used with declarative field annotations.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
readModel | KClass<*> | Any::class | From IProjectionFor<T> |
@Constraint
Section titled “@Constraint”Marks a class as a Chronicle constraint definition. The class must implement
IConstraint.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | "" | Stable identifier. Defaults to class name. |
@Seeder
Section titled “@Seeder”Marks a class as a Chronicle event seeder. The class must implement ICanSeedEvents.
Marks a property as personally identifiable information. Chronicle encrypts annotated fields at rest using a per-subject key. See PII Attribute for the full compliance model this participates in.
@EventTypedata class CustomerRegistered( val customerId: String, @Pii val email: String)@FromEvent
Section titled “@FromEvent”Applied to a read model class to declare that its fields are mapped from an event type. Part of the annotation-based projection style.
| Parameter | Type | Description |
|---|---|---|
eventType | KClass<*> | The source event class. |
key | String | Event property key. Default: "EventSourceId". |
@SetFrom
Section titled “@SetFrom”Applied to a read model property to declare which event field populates it.
| Parameter | Type | Description |
|---|---|---|
propertyPath | String | Event field name. Defaults to the property name. |