Skip to content

Actor model needs a Mailbox wrapper/concurrency-manager #4

@huan

Description

@huan

to make sure the events sent to an actor can be executed one by one (only process one at a time)

See: https://discord.com/channels/795785288994652170/800812250306183178/917025370186870794

image

I have just read a great article related to our discussion: Kotlin Concurrency with Actors, Jag Saund, Jun 14, 2018 (https://medium.com/@jagsaund/kotlin-concurrency-with-actors-34bd12531182), it discussed how to implement a Mailbox:

  1. "Signaling a Complete Operation with Actors"

Jag uses "Done message as a signal that tells us the Actor has processed all messages", I think the XState machine should have a similar state, for example, IDLE to indicate that it's not busy.

  1. "Distributing workload with Actors"

We can define a concurrency property in our Mailbox, and the Mailbox can spawn maximum concurrency actors to process the incoming events

  1. Mailbox as an EVENT proxy

The Mailbox should enqueue incoming (except its own actors) EVENT messages if there are no idle actors, and dequeue them and pass them to actors when there's any actor is idle.

On the other hand, all incoming EVENTS messages from their own actor should be respond to the original sender actor immediately.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions