senecajs / seneca-redis-pubsub-transport

Seneca micro-services message transport over Redis pubsub
MIT License
16 stars 20 forks source link

Redis transport works incorrectly #19

Closed SkeLLLa closed 8 years ago

SkeLLLa commented 8 years ago

Example:

const seneca = require('seneca')();
const Promise = require('bluebird');
const {co} = require ('bluebird-co');

co(function* startService() {
  const pin = {
    svc: 'pub',
    act: 'sub'
  };
  yield cb => seneca.use('redis-transport')
    .add(pin, function(args, respond) {
      console.log('Handler called, sending reply')
      respond(null, { res : 'ok' });
    })

    .listen({type:'redis', pin:pin})
    .ready(cb);
  const client = seneca.client({type:'redis', pin:pin});
  const act = Promise.promisify(client.act, {context: client});
  yield act(pin, {msg: 'pubmsg', date: new Date()});
});

This one is not working. Message is never received. And handler never called.

But if I modify client's pin with any text:

const client = seneca.client({type:'redis', pin:'foo:this_should_not_work'});

The handler is called and response is sent, when it shouldn't.

Why pins should be different?

dgonzalez commented 8 years ago

Hi, this seems related to https://github.com/senecajs/seneca-redis-pubsub-transport/issues/34

Please follow up in there (and feel free to reopen it if the answer does not work for you!)

SkeLLLa commented 8 years ago

@dgonzalez, ok. I've already write simple pubsub seneca plugin (whithout any transport logic) :).

BTW it will be great if this plugin used psubscribe instead of subscribe to handle wildcard subscriptions.