What I ended up doing was just setting a flag in  the request scope when I
need to fallback to an alternate SMTP server. I just set request.toggleSMTP
= true and then in the onRequestEnd() method, I check for that flag and do
the processing to update this.smtpserversettings   to an available server.
This works... 

I load so much crap into the app scope, that I don't want to re-initialize
the application!!

Brook

-----Original Message-----
From: Judah McAuley [mailto:[email protected]] 
Sent: December-06-11 9:31 AM
To: cf-talk
Subject: Re: Changing Application settings at runtime


In CF9, there is the ApplicationStop() method which will restart the
application on the next request, thus reinitializing the application scope.

Ben Nadel wrote up an investigation of this awhile back:
http://www.bennadel.com/blog/1667-Learning-ColdFusion-9-Resetting-Applicatio
ns-With-ApplicationStop-.htm

One thing to note is that calling ApplicationStop() does not reset the
Session scope. This could be viewed as either a bug or a feature.

So if you are ok with restarting the application while leaving the session
scope in place, I'd place the smtpserversettings in your
OnApplicationStart() method and make a call to whatever service you have
that knows what the currently valid server settings should be.

Of course you still have to figure out how to trigger the fact that you need
to reset the application because of a downed smtp server.

Hope this helps,
Judah

On Mon, Dec 5, 2011 at 5:30 PM, Brook Davies <[email protected]> wrote:
>
> So I have something like this at the top of application.cfc:
>
> <cfset this.smtpserversettings   = {
>  server="mail.yourmama.com",
>  username="[email protected]",
>  password="issofat"
> }>
>
> But I want to be able to change these settings when I (somehow) detect 
> that the server is down. From what I have read the only way to do this 
> would in onRequestStart or onRequestEnd. So I can set up a request 
> scoped flag that triggers the update, fine, but is that really the 
> only way? Is there no way to call a method of application.cfc within the
scope of the application?
>
> Broo



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348983
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to