★ wanayoo — archive 1999 https://github.com/msgflo/msgflo-nodejsNouvelle recherche | Portail wanayoo
Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Node.js participant support for MsgFlo
CoffeeScript JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
examples
spec
src
.gitignore
.travis.yml
Gruntfile.coffee
LICENSE
README.md
TODO.md
fbp-config.json
index.js
package.json

README.md

MsgFlo - Flow-Based Programming with Message Queues Build Status

MsgFlo is a distributed, polyglot FBP (flow-based-programming) runtime. It integrates with other FBP tools like the Flowhub visual programming IDE.

This library makes it easy to create MsgFlo participants in JavaScript/CoffeScript on node.js.

Status

Production

Licence

MIT, see ./LICENSE

Usage

Add as an NPM dependency

npm install --save msgflo-nodejs

A simple participant (CoffeeScript)

msgflo = require 'msgflo-nodejs'

RepeatParticipant = (client, role) ->
  definition =
    component: 'Repeat'
    icon: 'file-word-o'
    label: 'Repeats in data without changes'
    inports: [
      id: 'in'
      type: 'any'
    ]
    outports: [
      id: 'out'
      type: 'any'
    ]
  process = (inport, indata, callback) ->
    return callback 'out', null, indata
  return new msgflo.participant.Participant client, definition, process, role

client = msgflo.transport.getClient 'amqp://localhost'
worker = RepeatParticipant client, 'repeater'
worker.start (err) ->
  throw err if err
  console.log 'Worker started'

If you expose the participant factory function (examples/Repeat.coffee)

module.exports = RepeatParticipant

Then you can use the msgflo-nodejs exectutable to start participant

msgflo-nodejs --name repeater ./examples/Repeat.coffee

Debugging

msgflo-nodejs uses the debug NPM module. You can enable (all) logging using:

export DEBUG=msgflo*
Something went wrong with that request. Please try again.