ActorContext
The actor's context provides some helper functions for its message handler (Behavior
)
An instance of the actor context is passed to the actor's message handler, so the handler can use its helper functions.
Type parameters
- M
-
The actor's message base type
- S
-
The type of the actor's internal state
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Abstract methods
Send a response back to the sender of this message.
Send a response back to the sender of this message.
Value parameters
- response
-
The response message
Attributes
- Returns
-
The current behavior of the actor.
Replace the current state of the actor with a new state.
Replace the current state of the actor with a new state.
Under the hood, the current state might be either stored in memory (like in the StatefulActor) or on a persistent storage (like in PersistentActor).
Value parameters
- newState
-
The new state
Attributes
- Returns
-
The current behavior of the actor.
Takes the message which is currently processed by the message handler and puts it on the actor's message stash. This allows it to unstash and process the message later, depending on the current state of the actor.
Takes the message which is currently processed by the message handler and puts it on the actor's message stash. This allows it to unstash and process the message later, depending on the current state of the actor.
Attributes
- Returns
-
The current behavior of the actor.
Send a message of the actor's message type M
to the actor which is connected to this context.
Send a message of the actor's message type M
to the actor which is connected to this context.
Can be used to seld a message from within the actor's message handler (Behavior) to the same actor. The message will be enqueued at the end of the actor's message queue.
Value parameters
- message
-
A message of the actor's message type
M
Attributes
- Returns
-
The current behavior of the actor.
Moves all messages from the actor's message stash back to the end of the message inbox.
Moves all messages from the actor's message stash back to the end of the message inbox.
Attributes
- Returns
-
The current behavior of the actor.
Concrete methods
Waits asynchronously for the completion/cancellation/abortion of a given effect, transforms the outcome into a list of messages that is compatible with the actor's message type M
and sends these messages to the actor.
Waits asynchronously for the completion/cancellation/abortion of a given effect, transforms the outcome into a list of messages that is compatible with the actor's message type M
and sends these messages to the actor.
Type parameters
- A
-
The value type of the effect
Value parameters
- effect
-
An effect of type
A
- mapOutcome
-
A function that maps the outcome of the evaluation of the given effect to a list of messages of the actor's message type
M
The cats.effect.Outcome is either- Canceled
- Errored
- Succeeded.
Attributes
- Returns
-
The fiber of the given effect that has been started in the background, wrapped in an IO effect.