This example shows how actors can call each other without blocking themselves.
Features used Async Actors: Async actors with promises are already part of Tarant. Any method that is marked as async will be handled asynchronously and non-blocking by Tarant, and messages are guaranteed to be processed in order. Live Example See the Pen tarant ping pong example by Kevin Mas Ruiz (@kmruiz) on CodePen.
This example demonstrates how Actors process messages independently. When you press the +1 button, you will see how there are two counters, one that updates fast, and one that updates slower.
Load is simulated using a sleep function with a setTimeout.
Features used Topics: Topics encapsulate communication between actors in a fan out basis. Each actor subscribed to a topic will eventually receive messages in guaranteed order. In this specific use case, the +1 button is sending, each time the user clicks on it, a message through a topic.
This example shows how actors can schedule the execution of messages dynamically.
Features used Scheduleds: Scheduleds are handled by actors, are non-blocking and support asynchronous methods. Live Example See the Pen tarant scheduleds example by Kevin Mas Ruiz (@kmruiz) on CodePen.