Companion

Properties

Link copied to clipboard

Hands over the stored me.ahoo.wow.spi.log.EventRecords as they are, for sinks and generic handlers.

Functions

Link copied to clipboard
fun models(models: Collection<AggregateModel<*>>, codec: EventCodec = EventCodec()): EntryDecoder

Decodes each event into its class through codec and the model of the stream's aggregate among models, upgrading older revisions on the way, and leaves out the events the model retired. A stream of an aggregate with no model fails to decode.

Link copied to clipboard
fun stateEvents(states: SharedStateReader, decodeEvents: Boolean = true): EntryDecoder

The decoder of the state consumers: each event decoded into its class through states' codec and models, upgraded on the way, the events the model retired left out (unless decodeEvents is false: the stored records are handed over, all of them), and the aggregate's state after the stream read through states when the handler asks for it (SubscribedEntry.state): the context's shared view, else the nearest view or snapshot evolved with the log's tail, else the log replayed. Each subscription decodes the events afresh, so no handler sees another's instances (see EntryDecoder).