Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Node.js participant support for MsgFlo

License

NotificationsYou must be signed in to change notification settings

msgflo/msgflo-nodejs

Repository files navigation

MsgFlo is a distributed, polyglot FBP (flow-based-programming)runtime. It integrates with other FBP tools like theFlowhub 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, roleclient = 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 themsgflo-nodejs exectutable to start participant

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

Debugging

msgflo-nodejs uses thedebug 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,implementClient andMessageBrokerinterfaces.

You can then pass the Client instance into aParticipant.

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

About

Node.js participant support for MsgFlo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp