[Gambas-user] Generic event handler - is it possible?

Me adamnt42 at gmail.com
Sun Sep 30 12:07:27 CEST 2018


On Sun, 30 Sep 2018 10:20:03 +0200
Fabien Bodard <gambas.fr at gmail.com> wrote:

> And by using an observer ?
> 
> This observer can be created in the last object and maybe redirected to
> your main class ?
> 
> The only things you have to do is to have a way to get acces to the main
> object handle. Maybe via a static property.
> 
> So then the observer will duplicate the events and raise it to the main
> class.
> 
> So you can indicate to the observer to raise after the diplicate one an
> lock the raising from the children class before the main class catch.
> 
> If the error is managed in the far child then lock the raising else let the
> main manage it.
> 
> Hobs = new observer (me) as  "Satellite "
> 
> Object.attach (hobs, CMain.Current,"Satellite")
> 
> Maybe a way....
> 
> 
> Le dim. 30 sept. 2018 06:07, Me <adamnt42 at gmail.com> a écrit :
> 
> > On Sat, 29 Sep 2018 08:07:26 +0200
> > Fabien Bodard <gambas.fr at gmail.com> wrote:
> >
> > > >
> > > > Sorry Bruce... bad read... forget the last post
> > >
> > > >
> > > >>
> >
> > Rats! You got me all excited there.
> >
> > regards
> > Bruce
> > --
> > adamant42 at gmail.com
> >
> > ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> >

Sounds promising, I'll give it a go tomoorow.

I'll give a bit more explanantion though.
Every day we process between 80 and 2000 auction lots (thouroughbred horses) from 
1 to 20ish auction houses. This involves (say about) 12 messages we receive in
several (23) different ways.   Well over 80% of the messages we get in the morning (and
during the day) go through the system with no "problem". However, some times there 
is an exception that, well, happens. An example would be - a horse is registered as a
lot at a particular auction a few days before the actual sale, on the morning of the sale
the horse is delivered to the auction yard. On inspection it is founf to be lame, or the 
wrong color or it's a cow not a horse, or any one of a gazillion other things that
render the proposed lot disadvantageous for sale. While we are processing large
batches of messages from the auction houses we encounter some exception that
we cannot handle automatically, the most common being the delivered horse is not
the same color as the registered sale horse. The problem is that someone, somewhere
entered the wrong data: the vendor, the handlers at the yard, the clerical staff etc.
It can only be rectified by a human (we, anywhere up to 400km away, have no idea what
 color the actual horse is) and a phone call or a few phone calls.
Meanwhile the incoming message process really needs to continue with handling the 
next messages. Due the nature of the parsers  the message that has the problem can
be anywhere up to 6 or 7 levels deep in collections of collections of collections.   
So the Error.Raise mechanism doesn't work as it would unravel the execution stream 
and probably lose its place. The general idea of what I'm looking to achieve is that the
main code could catch an event, say "WrongColor" and write it out to a queue file of
messages thet need manual handling. Trying to manage it from the top down would be
a coding nightmare. So youre idea looks good so far.  (Decades ago, I could have 
written this in a dozen lines or so in PL1 using conditions and an OnAny$ condition
handler! Such is life.)

cheers
Bruce

-- 
adamant42 at gmail.com


More information about the User mailing list