EventEnvelope

zio.blocks.projection.EventEnvelope
final case class EventEnvelope[+E](seq: Long, tag: String, event: E, timestamp: Instant, entityId: String)

An event together with the metadata an EventStore records about it.

Envelopes are what an EventStore returns from readFrom and readAll, and what it publishes on its subscribe hub when a new event is appended. The ProjectionEngine reads them to run a projection's handlers: it passes event to the handler, along with a ProjectionContext built from entityId, timestamp and seq.

The type is covariant in E, so an EventEnvelope[UserCreated] can be used where an EventEnvelope[Any] is expected.

Type parameters

E

the event type

Value parameters

entityId

the entity the event was recorded under, which a handler sees as ctx.entityId

event

the event itself

seq

the position of the event in its store, increasing with each append. The engine saves the last seq it processed and resumes after it on restart

tag

the name that identifies the kind of event. The SQLite store uses the case name or the number from @eventTag, and replaces an old tag with its current one when tag aliases are configured. The in-memory test store uses the event class's simple name

timestamp

when the event was recorded

Attributes

Source
EventEnvelope.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala