How I can illustrate Akka actors in UML diagrams? Especially how to illustrate messages passed between actors? Any example will be fine. Thanks.
In UML, an actor is a model element that interacts with a system. As a model element, it can be an abstract person (e.g. “customer”) or another external system. In the practice of modeling it is recommended to define the role unambiguously with stereotypes – e.g. “User”, “Stakehoder” or “External System”.
What is an Actor in Akka? An actor is essentially nothing more than an object that receives messages and takes actions to handle them. It is decoupled from the source of the message and its only responsibility is to properly recognize the type of message it has received and take action accordingly.
1) Akka Actor tell() Method It works on "fire-forget" approach. You can also use ! (bang) exclamation mark to send message. This is the preferred way of sending messages.
Be careful, Akka actors and UML actors mean two very different things. For UML, an actor is something (a human or another system) interacting with the system. For Akka, it is an active object.
So, you can use either, a sequence diagram if you want to illustrate the interaction during the time, or communication diagram if you need only to illustrate messages order.
Aka Actors are self-contained entities with their own lifecycle. Akka actors interact by sending each other messages.
Replace "Akka Actors" with "Objects" in the above statement and you have a pretty good description of the OO model underpinning UML. So you can use Class Diagrams, State Diagrams, Sequence Diagrams etc. to model Actor-based systems.
You could make various refinements depending on your needs. For example, each class that represents an actor is <<active>>
. Or you could go further and introduce an <<Actor>>
stereotype. Depends on your audience & model purpose.
hth.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With