@akennedy/palmetto-redis

A redis adapter for palmettoflow

Usage no npm install needed!

<script type="module">
  import akennedyPalmettoRedis from 'https://cdn.skypack.dev/@akennedy/palmetto-redis';
</script>

README

Palmetto Redis

This module uses redis as the pub/sub messaging component for palmetto flow applications

Build Status

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.