Subject | RE: [IBO] Re: Reconnecting in a windows service |
---|---|
Author | Jason Wharton |
Post date | 2007-12-20T05:34:48Z |
Dany,
Thanks for jumping into this topic and helping out here.
I hear and acknowledge your grumblings.
It is overwhelming to try and do so many of these "little" things that do
matter that will help people make fuller use of the library. IBO is just
loaded to the brim with capabilities that I have yet to fully document so
that others can dependably make full use of them and this is one example of
that.
Service applications are very very powerful and I have recently been working
on a new one that will make a good candidate for another sample application.
In fact, I have written two of them in the past few months. One of them is
the entire community web-site server. It has been split up in such a way
that instead of ISAPI DLL's for script extensions I use run-time packages.
This allows me to have top notch debugging capabilities and no appreciable
difference between testing and production.
The new service application I just wrote was splitting off the part where
emails are sent in response to orders being received. There have been some
problems of too long of a delay and my credit card gateway wasn't getting a
response. This has helped a lot to partition off the sending of emails in
its own separate dedicated service application.
Anyway, I hear you and I do hope to unleash the power of service
applications for people more fully. They are a treat.
Jason
Thanks for jumping into this topic and helping out here.
I hear and acknowledge your grumblings.
It is overwhelming to try and do so many of these "little" things that do
matter that will help people make fuller use of the library. IBO is just
loaded to the brim with capabilities that I have yet to fully document so
that others can dependably make full use of them and this is one example of
that.
Service applications are very very powerful and I have recently been working
on a new one that will make a good candidate for another sample application.
In fact, I have written two of them in the past few months. One of them is
the entire community web-site server. It has been split up in such a way
that instead of ISAPI DLL's for script extensions I use run-time packages.
This allows me to have top notch debugging capabilities and no appreciable
difference between testing and production.
The new service application I just wrote was splitting off the part where
emails are sent in response to orders being received. There have been some
problems of too long of a delay and my credit card gateway wasn't getting a
response. This has helped a lot to partition off the sending of emails in
its own separate dedicated service application.
Anyway, I hear you and I do hope to unleash the power of service
applications for people more fully. They are a treat.
Jason
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of dmarmur2002
> Sent: Tuesday, December 11, 2007 10:37 AM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Re: Reconnecting in a windows service
>
>
> --- In IBObjects@yahoogroups.com, "havard_o" <havard_o@...> wrote:
> >
> > Hi,
> >
> > Apologies if I do any mistakes or if this is a FAQ (if so I haven't
> > found it :). I've got a Windows service which connects to a
> firebird
> > database. To do this I'm currently using a TIB_Connection.
> I've got a
> > guard clause procedure which does the following:
> > if conn.Connected then
> > Result := true
> > else
> > begin
> > try
> > conn.Connect;
> >
> > below this I've tried various exception handling but the
> Connect call
> > always throws an exception which "lands" way outside this
> procedure.
> > My service needs to have a valid connection before it can do any
> > processing and so what I need to do is:
> > 1. Check for connection
> > 2. If no valid connection, sleep and try to reconnect.
> > 3. If valid connection continue and do the work.
>
> No, FAQ, no (not that I know of). But an EXCELLENT example, sample, of
> how to get an fully automated service that will disconnect gracefully
> in any circumstance and reconnect when possible. Look at
> Samples/NTService. You just have to replace the replication stuff with
> what you are trying to do. I had to change one or two lines of code in
> the base classes to get it running and there are some posts from me
> that Jason (as usual *grump, grump* has deferred until... well) but
> even if you consult those posts the problems might be mine entirely.
> Mind that the sample is not runnable. Anyway it works like a charm
> after a bit of tweaking. I can disconnect my server - do maintainance
> and then bring it back on line without worrying about those services
> lying around in different nooks and dusty corners. And it uses threads
> - at least one. They (the services) will even refresh the metadata
> cache as appropriate! I have FTS indexing services, replication
> services for Outlook and groupwise and some other specialized stuff
> lying around in different levels of quantity and quality at my clients
> and the only thing that is a nuance after swithing to Jasons templates
> are... well you guessed right - M$ Outlook. Keep of it if you can -
> your life will be better. But that's another story.
>
> HTH,
>
> /Dany