Skip to main content
Inspiring
January 17, 2009
Question

How to not run a gateway instance if the target server is down

  • January 17, 2009
  • 3 replies
  • 2555 views
I have a DirectoryWatcher gateway instance that runs every 10 min looking to do a series of actions when a file is added to a directory on another server. This other server is down periodically and my gateway instance fails. Then when the server comes back up, I have to restart the gateway because it has failed. How do I tell the gateway instance to not run if the server it is looking at is down or the directory in this case is unavailable?
This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
February 10, 2009
How do I tell the gateway instance to not run if the server it is looking at is down or the directory in this case is unavailable?

I missed that one. Coldfusion's gateways are perpetual listeners, threads that are designed to run continuously.

Participant
March 11, 2010

listeners have a timeout period.  if the target computer is going through a reboot cycle, the downtime should be short enough that you can setup a timeout.  Set one that is long enough so that you do not trigger a failure event, and the timepsan allows for the target server to come back online before the timeout expiration.

Another way that is more robust is to create a seperate application, perhaps one built on Visual Studio or even a scripthost that does a simple ping of the destination server every 10 seconds or so.  When the server is not found, you can do a shutdown of your CF.    (you can shutdown any application from another application).   Once you can re-ping the server, relaunch your gateway listener.  If the listener cannot support what you want to do, just write another program that will perform your logic for you.


People have it within them to change

   

Proud user of Adobe products, and webmaster of the Theravive counselor network , built on Dreamweaver, and Photoshop.  Toss in a little Visual Studio, but who's keeping score!

BrianOAuthor
Inspiring
February 5, 2009
It works fine on other servers as long as permissions are set correctly.
BKBK
Community Expert
Community Expert
February 5, 2009
The DirectoryWatcher gateway is designed to check a directory on the same server, not on another server.