[cogen] In a PubSub, can't get the "key" to work.

0 views
Skip to first unread message

TK

unread,
May 3, 2010, 8:40:53 PM5/3/10
to cogen
I do the following in a coro:

yield pubsub.subscribe(key='TEST')
result = (yield pubsub.fetch(key='TEST'))

Messages are published to the PublisherSubscriberQueue via a normal
Pylons action,
similar to this:

def myaction(self):
yield request.environ['cogen.call'] (pubsub.publish)
('somedatahere', key='TEST')
yield "Some data was just published!"

And that works! Unfortunately it does not seem to respect the keys; If
I publish using a different key, the fetch (as in the first code
example) will still fetch it. What am I doing wrong?

I'm using cogen 0.2.1.

Kind regards,
Torbjørn

--
You received this message because you are subscribed to the Google Groups "cogen" group.
To post to this group, send email to co...@googlegroups.com.
To unsubscribe from this group, send email to cogen+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cogen?hl=en.

Ionel Maries Cristian

unread,
May 4, 2010, 12:13:38 AM5/4/10
to co...@googlegroups.com
It seems that the "key" feature was meant to be used for something else (update counters, eg: the key mean to associate a subscriber that calls fetch from multiple coroutines with a position in the queue, not to make a key-based message dispatcher). I guess this could be explained better in the docs.

I guess if you want the later you could implement a dispatcher yourself by using a map of pubsub queues (eg: for every key have mapping[key] = PublisherSubscriberQueue() ) .

-- ionel

TK

unread,
May 4, 2010, 2:07:51 PM5/4/10
to cogen
Thanks, that should do the trick!
> > cogen+un...@googlegroups.com <cogen%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/cogen?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "cogen" group.
> To post to this group, send email to co...@googlegroups.com.
> To unsubscribe from this group, send email to cogen+un...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/cogen?hl=en.
Reply all
Reply to author
Forward
0 new messages