msgflo-nodejs
Node.js participant support for MsgFlo
Last updated 3 years ago by jonnor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install msgflo-nodejs 
SYNC missed versions from official npm registry.

msgflo-nodejs 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*

Supporting other transports

msgflo-nodejs has a transport abstraction layer. So to support a new messaging system, implement Client and MessageBroker interfaces.

You can then pass the Client instance into a Participant.

Or you can register a new transport using msgflo.transport.register('mytransport', myTransportModule). Then you can get a Client instance using msgflo.transport.getClient('mytransport://somehost:666'). This has the advantage of also working when specifying the broker URL using msgflo-nodejs --broker or MSGFLO_BROKER= environment variable.

Current Tags

  • 0.11.1                                ...           latest (3 years ago)

32 Versions

  • 0.11.1                                ...           3 years ago
  • 0.11.0                                ...           3 years ago
  • 0.10.5                                ...           3 years ago
  • 0.10.4                                ...           3 years ago
  • 0.10.2                                ...           3 years ago
  • 0.10.1                                ...           3 years ago
  • 0.10.0                                ...           3 years ago
  • 0.9.1                                ...           3 years ago
  • 0.9.0                                ...           3 years ago
  • 0.8.2                                ...           3 years ago
  • 0.8.1                                ...           3 years ago
  • 0.7.2                                ...           4 years ago
  • 0.7.1                                ...           4 years ago
  • 0.7.0                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.5.2                                ...           4 years ago
  • 0.5.1                                ...           4 years ago
  • 0.4.13                                ...           4 years ago
  • 0.4.12                                ...           5 years ago
  • 0.4.11                                ...           5 years ago
  • 0.4.10                                ...           5 years ago
  • 0.4.9                                ...           5 years ago
  • 0.4.8                                ...           5 years ago
  • 0.4.7                                ...           5 years ago
  • 0.4.6                                ...           5 years ago
  • 0.4.5                                ...           5 years ago
  • 0.4.4                                ...           5 years ago
  • 0.4.3                                ...           5 years ago
  • 0.4.2                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 32
Dependencies (8)
Dev Dependencies (8)

Copyright 2014 - 2017 © taobao.org |