[Zope3-dev] Event service subscribe pattern

Gary Poster Gary Poster" <garyposter@earthlink.net
Thu, 18 Apr 2002 15:29:32 -0400


----- Original Message -----
From: "Steve Alexander" <steve@cat-box.net>
To: <garyposter@earthlink.net>
Cc: <zope3-dev@zope.org>
Sent: Thursday, April 18, 2002 12:35 PM
Subject: [Zope3-dev] Event service subscribe pattern


> Gary Poster wrote:
> >
> > 2. (subscribe pattern)
> >
> > Given the same arrangement of event services from question 1, when an
object
> > calls "subscribe" (the hookable function "subscribe(context, subscriber,
> > event_types=(None,), filter=None)") from within the child placeful event
> > service, what should happen?  should the subscription be registered with
the
> > child or passed on to the parent?
>
> If by "hookable function" you mean the "subscribe" in Event/hooks.py,
> then this is only for use by FileSystem services that want to subscribe
> to the filesystem ZCML-configured EventService.
>
> Placeful objects shouldn't be using this hook.

Absolutely; sorry for the confusion.  I am altering the hooks to match the
patterns of placeful and placeless services as established with the two
service managers (file system and persistent).  I was referring to a
hypothetical placeful hook (which isn't so hypothetical in my copy :-)

> When a placeful persistent object wants to subscribe, it gets the
> nearest appropriate placeful eventservice, and subscribes to it.
>
> In some cases, the nearest placeful eventservice will to relative to the
> object itself. In other cases, it will be relative to some other object
> it is interested in.

Agreed and understood.

> However, there should be no "global vs local" choice. Objects subscribe
> and unsubscribe placefully.

Just to clarify, I'm using "global" to refer to filesystem services and
"local" for persistent services.  In that sense, I'm actually not proposing
that objects be able to subscribe either to the file-system or to the local
event service but that objects be able to subscribe to the nearest event
service or the top *placeful/persistent* service.

Which you  may have understood and disagreed with anyway.  Which might be
quite right, since you can get the top event service by choosing an object
for context that is at the top of the tree.

So for now, I will proceed with that understanding: all subscriptions are to
the nearest event service to the given context, period.

Gary

PS Thanks for dividing up the stuff into three emails: a good choice, and
sorry I didn't do it. ;)