Behavior

peloton.actor.Behavior
trait Behavior[S, M]

The actor's behavior.

Behavior is basically a function that takes the current state of the Actor and an incoming message as arguments and returns a new Behavor which is then used by the actor to process the next incoming message.

Type parameters

M

The actor's message base type

S

The type of the actor's internal state

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def receive(state: S, message: M, context: ActorContext[S, M]): IO[Behavior[S, M]]

The actor's message hander.

The actor's message hander.

Value parameters

context

The ActorContext. Can be used to modify the actor's state or stash/unstash messages.

message

The incoming message

state

The current state of the actor

Attributes

Returns

A possibly new Behavior, based on the actor state and the message. If no behavioral change is intended, the current behavior can be accessed via ActorContext.currentBehavior.