Wind is a JavaScript library for building software using the actor system model.
- Actors are easy to reason about: An actor is the unit of state and logic of your application. They are transactional, so you don't need to handle state rollbacks in case of errors.
- Actors improve performance: Asynchronous by default, every actor actual communication is non-blocking so slow actors will not block fast actors.
- Actors are extensible: As actors are built on top of objects, actor classes can be inherited, composed and injected.
Wind.js is in a point that contains several features that are really useful for modeling an application.
- Actors are reliable because they are transactional. You don't need to bother yourself with error recovery.
- Actors are performant, as they are pull-based and decoupled from other actors lifecycle.
- Actors are easy to debug. All messages come with information about the sender and all the state information is saved in a time machine, for further debugging and navigation.
- The Actor System has an event bus. Actors can subscribe, publish and request messages from any topic and subscriptions can be handled at any time.
- The Actor System is highly extensive. You can add your own supervisor and materializer to add new features like implicit persistence or rendering of actors.
- Actors support asynchronous messaging and answering through Promises. Slow actors will not block fast actors.
- Actors can communicate through an event bus to improve extensibility. You can also requests answers through an event bus.
- Actors are safe and can be recovered with a supervisor
Creating your first actor system is easy and you don't need to understand everything that is happening under the hood. First you must install the package:
npm install wind.js --save
Then create your first ActorSystem
const ActorSystem = require("wind.js");
let system = ActorSystem.Builder().build();
system.start();
And create your actor class:
class Ping extends system.Actor {
onReceive({message}) {
console.log(message.toUpperCase());
}
}
Then you only need to instantiate your actor and send messages to it:
let myPinger = new Ping();
system.tell(myPinger, "ping");
The application will continue running and processing messages until you stop the actor system:
system.stop();
If you run the application you will see the following output:
PING
If you want deeper documentation on how to use the actor system, take a look at here.
PR and issues are always welcome as a quick way of contributing to the project. Remember to be polite, this is a open source project and ordinary requirements for PRs and issues are also a requirement.
If you want to be a long-term contributor and participate actively on the design of new features on the project, contact us! Check the package.json to see who you need to contact.
Player graphic by pixel_perfect from Flaticon is licensed under CC BY 3.0. Check out the new logo that I created on LogoMakr.com https://logomakr.com/8CWVt1