Re: Barracuda: Multiple listeners

Ron Alsobrook <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Everything's working fine but I wanted to understand a little more.  You 
actually answered the question I was asking with just this...

"If you have multiple listeners listening for the exact same event, then
they will get notified based on who registered first (I think)."

...but the rest of it was good too, especially since the notifyAlways() method 
was exactly what I needed.  Thanks.

Ron


-----Original Message-----
From: Christian Cryder
Sent: Wednesday 11 December 2002 12:39 pm
Subject: RE: Barracuda:  Multiple listeners

> Hi Ron,
>
> Consider the following event hierarchy snippet...
>
> <build-events pkg="com.atmr.nxgenw.events">
>     <req-events>
>         <event name="LocalReqEvent">
>             <event name="PublicEvent">
>             <event name="LoginEvent">
>                 <event name="GetLogin"/>
>                 <event name="DoLogin"/>
>                 <event name="GetEmailPassword"/>
>                 <event name="DoEmailPassword"/>
>             </event>
>             <event name="BackupDatabase"/>
>             <event name="GetTableOfContents"/>
>         </event>
>         <event name="AuthEvent">
>             <event name="HomeReq">
>                 <event name="GetHome"/>
>             </event>
>
> If the client browse fires GetHome.event, the Barracuda event model will
> first dispatch to listeners (assuming they exist) interested in AuthEvent,
> HomeReq, and finally GetHome. So if I have a listener on AuthEvent, it will
> get the chance to handle the request _before_ the listener for GetHome
> does. If AuthEvent actually sends back a response (isHandled = true),
> GetHome will never get notified, since the request has been handled and a
> response has been sent back to the client. The only exception to this would
> be if the listener interface implements notifyAlways = true (ie. I am
> logging, so always notify me of this event, even if its already been
> handled by someone else).
>
> The point of this example is that the event model is hierarchical based on
> how your events extend from DefaultBaseEvent. ControlEvents are always
> dispatched DOWN the event hierarchy (Polymorphic interface), ViewEvents are
> always dispatched UP the event hierarchy (Exceptional interface).
>
> If you have multiple listeners listening for the exact same event, then
> they will get notified based on who registered first (I think).
>
> If you have questions, maybe give us a little more information regarding
> your app domain/event hierarchy so we can understand what you are trying to
> accomplish and then better recommend how to go about achieving it...
>
> Christian
> ----------------------------------------------
> Christian Cryder [[email protected]]
> Internet Architect, ATMReports.com
> Barracuda - http://barracuda.enhydra.org
> ----------------------------------------------
> "Coffee? I could quit anytime, just not today"
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]On
> > Behalf Of Ron Alsobrook
> > Sent: Wednesday, December 11, 2002 3:28 PM
> > To: [email protected]
> > Subject: Re: Barracuda: Multiple listeners
> >
> >
> > That helps tremendously and everything's working now.  One quick
> > question:
> > What do you mean by "higher up the event chain"?  Does that just mean the
> > order in which interests were specified or does it mean something
> > else?  I'm
> > pretty much in the dark when it comes to the internals of the
> > event model.
> >
> > Ron
> >
> >
> > -----Original Message-----
> > From: Christian Cryder
> > Sent: Wednesday 11 December 2002 10:52 am
> > Subject: RE: Barracuda:  Multiple listeners
> >
> > > Hi Ron,
> > >
> > > Whichever one is higher up the event chain will get called first. By
> > > default, DefaultBaseEventListener returns true from the
> >
> > isHandled() method,
> >
> > > meaning subsequent listeners won't get notified. If all you are doing
> > > is logging in the parent listener, then override this method to
> >
> > return false
> >
> > > (thereby telling teh event handler to keepo dispatching)
> > >
> > > That help?
> > >
> > > Christian
> > > ----------------------------------------------
> > > Christian Cryder [[email protected]]
> > > Internet Architect, ATMReports.com
> > > Barracuda - http://barracuda.enhydra.org
> > > ----------------------------------------------
> > > "Coffee? I could quit anytime, just not today"
> > >
> > > > -----Original Message-----
> > > > From: [email protected]
>
> [mailto:[email protected]]On
>
> > > Behalf Of Ron Alsobrook
> > > Sent: Wednesday, December 11, 2002 1:15 PM
> > > To: [email protected]
> > > Subject: Barracuda: Multiple listeners
> > >
> > >
> > > I'm not clear on some of the details when using multiple
> > > listeners on a single
> > > event.  I have two control event handlers in two different
> > > gateways listening
> > > to a single event.  That event is actually a parent event that never
>
> gets
>
> > > explicitly generated by the client, but all of the child events
> > > are specified
> > > as interests in various gateways.  It seems I can't get both handlers
> > > to execute, only one at a time.  Do I need to do something special to
> > > make this
> > > work?  Also, in what order are events queued in such a case?
> > > Thanks again.
> > >
> > > Ron
> > >
> > > _______________________________________________
> > > Barracuda mailing list
> > > [email protected]
> > > http://www.enhydra.org/mailman/listinfo.cgi/barracuda
> > > FAQ - http://www.jguru.com/faq/Barracuda
> >
> > _______________________________________________
> > Barracuda mailing list
> > [email protected]
> > http://www.enhydra.org/mailman/listinfo.cgi/barracuda
> > FAQ - http://www.jguru.com/faq/Barracuda
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/barracuda
> FAQ - http://www.jguru.com/faq/Barracuda
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/barracuda
> FAQ - http://www.jguru.com/faq/Barracuda


_______________________________________________
Barracuda mailing list
[email protected]
http://www.enhydra.org/mailman/listinfo.cgi/barracuda
FAQ - http://www.jguru.com/faq/Barracuda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.