Git Product home page Git Product logo

node-actors's Introduction

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.

node-actors's People

Contributors

flashingpumpkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rafanami spencerx

node-actors's Issues

Cannot find module 'uuid'

When I try to execute the example, the following error is occurring:

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'uuid'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/Users/rafanami/Sites/example/node_modules/actors/lib/actors.js:14:10)
at Object. (/Users/rafanami/Sites/example/node_modules/actors/lib/actors.js:108:4)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)

Then I cut the example only on requiring the actors module, and the same exception stack occurred.
Maybe is a bug because of the renaming of the uuid library (now node-uuid?).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.