Handler

zio.blocks.projection.Handler
final case class Handler[E, A](eventClass: Class[E], schema: Schema[E], tag: String, fn: (E, ProjectionContext) => ProjectionAction[A])

Says what to do when an event of type E arrives: a function from the event and its ProjectionContext to a ProjectionAction on the projected type A.

Handlers are created by HandlerBuilder, not by hand. They contain no effects: a handler only describes the change, and the engine applies it.

Value parameters

eventClass

the runtime class used to recognise events this handler is for

fn

turns an event into the action to apply

schema

the schema of the event type

tag

the name of the event type, used in messages

Attributes

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

Members list

Value members

Concrete methods

def matches(event: Any): Boolean

Whether event is an instance of this handler's event class.

Whether event is an instance of this handler's event class.

Attributes

Source
Projection.scala
def runAny(event: Any, ctx: ProjectionContext): ProjectionAction[A]

Runs the handler on an event whose type is only known as Any. The cast is unchecked, so call matches first.

Runs the handler on an event whose type is only known as Any. The cast is unchecked, so call matches first.

Attributes

Source
Projection.scala

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