Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Akka. How to illustrate actors in UML?

How I can illustrate Akka actors in UML diagrams? Especially how to illustrate messages passed between actors? Any example will be fine. Thanks.

like image 868
WelcomeTo Avatar asked Jun 16 '13 17:06

WelcomeTo


People also ask

How do you define an actor in UML?

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”.

How do actors work in Akka?

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.

How can I send a message to an actor in Akka?

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.


2 Answers

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.

like image 98
Xaelis Avatar answered Sep 28 '22 09:09

Xaelis


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.

like image 24
sfinnie Avatar answered Sep 28 '22 07:09

sfinnie