Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simple message passing for node.js
JavaScript CoffeeScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
lib
src
test
LICENCE
README.md
package.json

README.md

Actors

Lots has been said about actors and message passing. I've been wondering how to do that easily both between processes and objects in the same process.

Synopsis

var actors = require('actors');
var server = actors.createConnection({ host: 'localhost'});

server.on('ready', function(){
    var shop = server.createActor('shop');
    var customer = server.createActor('customer');

    shop.on('message', function(message){
        if(message.reply){
            message.reply({cakes: 10})
        }
    })

    customer.on('ready', function(){
        customer.send('shop', { question: 'How many cakes are left?' }, function(reply){
            customer.send('shop', { order: reply.cakes })
        });
    });
});

Installation

npm install actors

Connection

The options on actors.createConnection are the same as for node-amqp

For more info check out the docs.

Something went wrong with that request. Please try again.