We are always improving the documentation, but we can offer the following tutorials about tarant.
Tarant is a JavaScript library that implements the Actor Model, which makes concurrent programming easy to understand and maintain. Thus, the most important building block of Tarant is the Actor. This getting started guide will walk you through the basic flow of starting an Actor System (which holds actor references) and your first actor, in a running application.
Setting up Tarant The only step needed for using Tarant is installing the library.
Actor Systems hold all the information about the location of all the actors on an application, even if they are in memory or not. They are composed of:
Materializers Resolvers A Top Level Supervisor Fibers Mailboxes There are two main ways to create an Actor System in tarant. One uses the default configuration, and the other one lets the developer configure most of the advanced fields for customizing the behaviour.
Actors represent the main unit of logic in the Actor Model. They are transactional, asynchronous and safe. When you work with actors, you have the following guarantees:
A single actor will process a single message at a time. For example, if you call a method in an actor two times, you will not process those calls in parallel, but sequentially. A single actor will process messages in order. For example, if you call two different methods in an actor, messages will be processed in the calling order.
Sometimes creating a whole actor is not needed because the problem to solve is relatively simple and a set of functions is enough. Tarant contemplates this scenario allowing the developer to write function actors, that benefit from some of the properties of actors, but are simpler.
They are asynchronous and non-blocking They can be composed They partially benefit from materializers However, there are some drawbacks compared to normal actors:
Tarant implements a basic, but powerful pubsub mechanism named topics. A topic is a stream of events that are sent to all subscribers of the topic. For example, if we send the event hello to the topic salutations, and there are three subscribers, all of them will receive a copy of hello.
Messages send through a topic are guaranteed to be processed only once by the topic and in order.