Class/Object

io.funcqrs.interpreters

AsyncInterpreter

Related Docs: object AsyncInterpreter | package interpreters

Permalink

class AsyncInterpreter[A, C, E] extends Interpreter[A, C, E, Future]

An Interpreter with F[_] bounded to Future.

All command handling are interpreted to Future of Events.

A

- the Aggregate type

C

- the Command type

E

- the Event type

Linear Supertypes
Interpreter[A, C, E, Future], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsyncInterpreter
  2. Interpreter
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AsyncInterpreter(behavior: Behavior[A, C, E])

    Permalink

    behavior

    - a Aggregate Behavior

Type Members

  1. type Aggregate = A

    Permalink
    Definition Classes
    Interpreter
  2. type Command = C

    Permalink
    Definition Classes
    Interpreter
  3. type Event = E

    Permalink
    Definition Classes
    Interpreter
  4. type Events = Seq[E]

    Permalink
    Definition Classes
    Interpreter
  5. type InterpreterFunction = PartialFunction[(Command, CommandHandlerInvoker[Command, Event]), Future[Events]]

    Permalink
    Definition Classes
    Interpreter

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def applyCommand(state: Option[A], cmd: Command): Future[(Events, Option[A])]

    Permalink
    Definition Classes
    AsyncInterpreterInterpreter
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val behavior: Behavior[A, C, E]

    Permalink

    - a Aggregate Behavior

    - a Aggregate Behavior

    Definition Classes
    AsyncInterpreterInterpreter
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def fromTry[B](any: Try[B]): Future[B]

    Permalink

    Natural transformation from Try to a F

    Natural transformation from Try to a F

    In the occurrence of missing behavior, we have no other choice than emitting a MissingBehaviorException. This is wrapped in a Try that must be transformed to the correct error type for F[_]

    any

    - the produced events

    Attributes
    protected
    Definition Classes
    AsyncInterpreterInterpreter
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. def interpret: InterpreterFunction

    Permalink

    The interpret PartialFunction is specific to each interpreter.

    The interpret PartialFunction is specific to each interpreter. It's responsible for executing the command and lifting the output to F[_]

    // example of interpret for an AsyncInterpreter
      def interpret: InterpreterFunction = {
        case (cmd, IdCommandHandlerInvoker(handler))      => Future.successful(handler(cmd))
        case (cmd, TryCommandHandlerInvoker(handler))     => Future.fromTry(handler(cmd))
        case (cmd, FutureCommandHandlerInvoker(handler))  => handler(cmd)
      }
    Attributes
    protected
    Definition Classes
    AsyncInterpreterInterpreter
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def onCommand(state: Option[Aggregate], cmd: Command): Future[Events]

    Permalink
    Definition Classes
    Interpreter
  20. final def onEvent(state: Option[Aggregate], evt: Event): Option[Aggregate]

    Permalink

    Apply all 'evt' on passed 'state'.

    Apply all 'evt' on passed 'state'.

    state

    - the aggregate current state

    evt

    - event to be applied

    returns

    new aggregate state after applying event

    Definition Classes
    Interpreter
    Exceptions thrown

    MissingEventHandlerException if no Event handler is defined for the passed event.

  21. final def onEvents(state: Option[Aggregate], evts: Events): Future[Option[Aggregate]]

    Permalink

    Apply all 'evts' on passed 'state'.

    Apply all 'evts' on passed 'state'.

    state

    - the aggregate current state

    evts

    - events to be applied

    returns

    new aggregate state after applying all events

    Definition Classes
    Interpreter
    Exceptions thrown

    MissingEventHandlerException if no Event handler is defined for one of the passed events.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Interpreter[A, C, E, Future]

Inherited from AnyRef

Inherited from Any

Ungrouped