1.0.3 • Published 10 years ago
@akennedy/palmetto-redis v1.0.3
Palmetto Redis
This module uses redis as the pub/sub messaging component for palmetto flow applications
usage
configure
var io = require('@akennedy/palmetto-redis')({
  endpoint: 'http://localhost:6379',
  app: '<appname>'
})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) {
  // do work
  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.