[Zope3-dev] publishEvent bubble pattern

Gary Poster Gary Poster" <garyposter@earthlink.net
Thu, 18 Apr 2002 15:40:23 -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:17 PM
Subject: [Zope3-dev] publishEvent bubble pattern


> Gary Poster wrote:
> >
> > 1. (publishEvent bubble pattern)

> Another way of doing things is to take advantage of the ZODB concurrency
> guarentees, and have an EventService hold on to the event while it is
> sending it out. When it receives an event, it compares it to the event
> it is currently sending out (if any), and ignore the received event if
> it matches.
>
> So, I don't think we need the "caller" argument.

Does that method potentially get into threading issues?  I am not familiar
with the concurrency guarantees.

Is the idea that if a service asked a higher service to publish an event, it
would then place the event in a personal holding bucket right before asking;
order of execution would then mean that, if the higher service were to
re-notify the requesting lower service, the lower service could check to see
if the event were in the holding bucket, and if so, ignore the event; and
when eventually program execution returned to the lower service after
calling "publishEvent" it could immediately remove the event object from the
bucket?  That sounds reasonable, but I just want to make sure that's where
you're going, and that it is threadsafe etc.

I like the idea a lot, if I understand it and it works. :-)

> There's also the issue of whether the "parent" event service gets
> notified (via publishEvent) before or after the direct subscribers. I
> suggest that the direct subscribers get notified before the parent event
> service, but that this behaviour is officially undefined.

That's what was in my diagram as well, I think.  Agreed, in any case.

Gary