If you have actors depending on each other, you may want them to exit together if one of them terminates. Therefore you can
connect them as peers. Then an actor will send an
Exit message to its connected actors. Those propagate the
Exit message (caused by a failure,
exit!) to their connected actors and then terminate
- if the exit
reasonis other than
- and if they are not
trapExit an actor can be made
:sticky. When it then receives an
Exit message with a reason other than
:normal, it will
- not propagate it and not terminate but
- give a warning about it and
- store a link to the failed actor.
Connections between actors are always bidirectional and can be
disconnected. You can build a chain or network of connected actors that depend on each other and exit together. A
:sticky actor operates as a firewall among connected actors.
Assume in an actor system
A4 are connected,
A3 is a
:sticky actor and
A9 fails. Before it terminates, it sends an
Exit message to
A7 propagates it further to
A7 die together.
A3 gives a warning about the failure and saves the link to the failed actor
A3 does not propagate the
A3 stay connected and continue to operate. The other actors are separate and are not affected by the failure.
See a Julia script illustrating the above system in the How-to section.