Palmetto RMQ
This module uses rabbitMQ as the pub/sub messaging component for palmetto flow applications

usage
configure
var io = require('@twilson63/palmetto-rmq')({
endpoint: 'amqp://guest:guest@localhost:5672',
app: '<appname>',
vhost: '<optional>'
})
subscribe
io.on('foobar', function (msg) {
console.log(msg)
})
publish
io.emit('send', msg)
common patterns
frontend component query
var uuid = uuid.v4()
io.on(uuid, function (event) {
console.log(event.object)
})
io.emit('send', {
to: 'widget.all.request',
from: uuid,
subject: 'widget',
verb: 'all',
type: 'request',
object: {}
})
backend service
io.on('widget.all.request', function (event) {
var results = ...
io.emit('send', {
to: event.from,
subject: 'widget',
verb: 'all',
type: 'response',
object: results
})
})
The service listens to the widget.all.request
svc then uses the from
node to publish the response to.