Subject RE: [IBO] IB_Events question
Author Jason Wharton
Daniel,

My IBS_Base.pas/dfm is a TServiceApp that essentially works just like this.
I really need to develop the documentation on this more than I have, but it
sounds ideal for what you are trying to accomplish.

Essentially, the service app goes to sleep and every so often it wakes up
and checks the connection to the database to see if it is still alive. If
not, then it attempts to deal with it and then goes back to sleep if it
succeeds or fails. When it wakes up it tries to establish or verify the
connection again. I use about a 2 to 10 minute sleep interval.

Of course, if your connection is good and the AST of the event is triggered
then it hits the OnWakeUp event and the service app is jolted from its nap
and it immediately goes to work finding out who woke it up and it does its
thing and goes back to sleep. The service control thread also performs a
wakeup so that it can tidy up and close on a shutdown or stop request.

This service app module is designed to serve as a base class with protected
virtual methods that can be overridden to have the relevant functionality
plugged into them. There is a lot of the groundwork already laid, like
providing the worker thread, logging to a text file is easy, sending off an
email notification (well, I've got some issues here to deal with since they
changed from NM to Indy), and the sleep stuff, etc. is all pretty well
provided in a framework.

Hope this helps explain to some extent how this works.

Jason Wharton
www.ibobjects.com


> -----Original Message-----
> From: Daniel Jimenez [mailto:d.jimenez@...]
> Sent: Tuesday, November 23, 2004 7:56 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] IB_Events question
>
>
>
> Hi,
>
> I am about to modify an application, so that it will make use
> of "Events"
> triggered by the Firebird DB. Thus, I will make use of
> IB_Events. However, I
> am concerned about a few things.
>
> 1. Is there a component within IBObjects which works as a
> "WatchDog" that
> is, we can monitor the connection to the DB, so that if we loose the
> connection to the Database, the watchdog will see this and
> reconnect, or
> trigger an even in the application so that it can reconnect
> to the DB. The
> reason for this, is that I would like to have the IB_Events setup as
> passive.
>
> Thanks
>
> danieL.
>