Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Serialize a Sequence of Asynchronous Actor Messages?

I realize the topic sounds paradoxical 😊, but I’d like to gather thoughts on how others design solutions for the following use case:


Example Scenario

  1. Actors involved: Root Actor, A, B, C, D.

    • Root Actor launches all other actors.
  2. Hardware interaction:

    • Actors C and D interact with a Hardware Actuator and Camera respectively.
    • They cannot be simple driver classes because they include UI and continuous monitoring.
  3. Message flow:

    • Actor A sends messages to C and D, e.g., move actuator to 10 mm and take an image.
    • Similarly, Actor B also interacts with C and D.
  4. Sequencing requirement:

    • Actor A needs to execute a large sequence of actuator moves and camera captures one after another.

Current Approach

I can implement sequencing in Actor A using states within its private data to progress through steps.


Main Question

This pattern appears often:
An actor needs to interact with multiple actors and execute a serialized sequence of messages, waiting for each response before proceeding to the next step.

How can this be abstracted into parent actors or interfaces so that any actor can easily get this sequencing feature?

0 Kudos
Message 1 of 2
(64 Views)

Can you switch your architecture around such that you do have a simple hardware driver class, then implement "monitor" classes that can monitor the device and handle your UI? As it is now, you have one Actor that's handling UI, monitoring, and some sequencing, which seems like a lot.

 

If you can write the hardware driver such that it's "thread safe" where multiple callers can interact with it independently, this would probably make things a lot easier.

 

Driver aside, I think bundling your states into something other than your main actor is a good idea.

0 Kudos
Message 2 of 2
(44 Views)