GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - msgflo/msgflo-nodejs: Node.js participant support for MsgFlo

BranchesTags
Open more actions menu

Latest commit

 

History

358 Commits
358 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
examples
examples
 
 
spec
spec
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
CHANGES.md
CHANGES.md
 
 
Gruntfile.coffee
Gruntfile.coffee
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
TODO.md
TODO.md
 
 
fbp-config.json
fbp-config.json
 
 
index.js
index.js
 
 
package.json
package.json
 
 

Repository files navigation

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

  • Used at TheGrid for all workers using AMQP/RabbitMQ, including in imgflo-server
  • Also used by noflo-runtime-msgflo
  • Experimental support for MQTT and direct transports

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.

About

Node.js participant support for MsgFlo

Topics

amqpmessage-passingmqtt

Resources

Readme
MIT license
Activity
Custom properties

Stars

9 stars

Watchers

4 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.