-
Notifications
You must be signed in to change notification settings - Fork 1
Concepts
durable.js is designed for writing programs that last long periods of time and react to sporadic external events. This is a very common pattern in enterprise applications that coordinate interactions with external services or require human intervention. durable.js relies on the json type system through and through: it exposes a REST interface for posting messages as json objects, it stores the program state in a document database (MongoDb) as json objects and the program itself is defined as a json object. As a result the programming model is simple and consistent and the system performance is optimal because resources are not wasted in type system mappings.
durable.js stores the program state as a collection of historical records in a document database. Historical records enable aggregating and analyzing program data without degrading the system performance. Incoming events are stored as durable messages in a collection in the same database. Messages are correlated with and dispatched to the program event handlers following a similar callback model to that of node.js. Let's consider the following simple example:
A session is the program state. A session is an addressable object. The session definition and content are completely owned by the user. Session have historical records, that is, each durable session update is a new record in a collection.
- Checkpoint
- Fork
- Join
- Receive
- Post
A promise is a unit of execution. A promise performs work on a session. A set of promises represent the program logic. Promise verbs:
- Run
- ContinueWith
- Type System
- State management
- Fault tolerance
- Input\Output
- Events
- Sequence
- Streams
- Statechart
- Flowchart