edomata.core

package edomata.core

Type members

Classlikes

final case class Action[F[_], R, E, N, A](run: F[Response[R, E, N, A]])

A monad transformer for Response

A monad transformer for Response

Type parameters:
A

output type

E

domain event type

F

effect type

N

notification type

R

rejection type

Companion:
object
Companion:
class
sealed transparent trait ActionCatsInstances
sealed transparent trait ActionConstructors
final case class CommandMessage[+C](id: String, time: Instant, address: String, payload: C, metadata: MessageMetadata)

Representation of a standard command message

Representation of a standard command message

Type parameters:
C

Command payload which is your command model

Companion:
object
Companion:
class
sealed trait Decision[+R, +E, +A] extends Product with Serializable

Represents programs that decide in an event driven context

Represents programs that decide in an event driven context

This is basically a simple state machine like the following:

[*] -> InDecisive
InDecisive -- event --> Accepted
InDecisive -- join --> InDecisive
InDecisive -- rejection --> Rejected (resets and terminates)
Accepted -- event --> Accepted (accumulates)
Accepted -- rejection --> Rejected (resets and terminates)

It forms a monad error and also is traversable.

Type parameters:
A

program output type

E

event type

R

rejection type

Companion:
object
final case class DecisionT[F[_], R, E, A](run: F[Decision[R, E, A]])

This is monad transformer for Decision

This is monad transformer for Decision

Type parameters:
A

program output type

E

event type

F

effect type

R

rejection type

Companion:
object
sealed transparent trait DecisionTCatsInstances
sealed transparent trait DecisionTConstructors
final class Domain[C, S, E, R, N](dummy: Boolean) extends AnyVal
final class DomainDSL[C, S, E, R, N](dummy: Boolean) extends AnyVal

A purely functional, event driven domain model

A purely functional, event driven domain model

Type parameters:
Event

domain events

Rejection

domain error type

State

state model of your program, a.k.a aggregate root

final case class Edomaton[F[_], -Env, R, E, N, A](run: Env => F[Response[R, E, N, A]]) extends AnyVal

Represents programs that are event driven state machines (a Mealy machine)

Represents programs that are event driven state machines (a Mealy machine)

these programs can use input to decide on a state transition, and optionally emit a sequence of notifications for communication.

Type parameters:
A

output type

E

internal event type

Env

input type

F

effect type

N

notification type, a.k.a external event, integration event

R

rejection type

Companion:
object
sealed transparent trait EdomatonConstructors
sealed transparent trait EdomatonInstances
enum EdomatonResult[S, E, R, N]

Representation of the result of running an edomaton

Representation of the result of running an edomaton

final case class MessageMetadata(correlation: Option[String], causation: Option[String])

Representation of a standard message metadata

Representation of a standard message metadata

Companion:
object
Companion:
class
@implicitNotFound("Cannot find domain model definition for State: ${State}, Event: ${Event}, Rejection: ${Rejection}") @implicitAmbiguous("Domain model definition must be unique!")
sealed trait ModelTC[State, Event, Rejection]

A type class that captures domain model

A type class that captures domain model

note that due to uniqueness requirements for this typeclass, it is sealed and the only way to create an instance is through implementing DomainModel.

so don't create several instances as it is a bad idea and may change your domain model behavior in different contexts!

final case class RequestContext[+C, +S](command: CommandMessage[C], state: S)

Representation of a standard input for an Edomaton

Representation of a standard input for an Edomaton

Type parameters:
C

Command type

S

State model type

final case class Response[+R, +E, +N, +A](result: Decision[R, E, A], notifications: Chain[N])

Representation of programs that decide and emit notifications

Representation of programs that decide and emit notifications

This adds capability of emiting notifications/integration events to Decision programs

Type parameters:
A

output type

E

domain event type

N

notification type

R

rejection type

Companion:
object

Types

type DomainService[F[_], C, R] = C => F[EitherNec[R, Unit]]