> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Peter H
> Sent: Wednesday, August 10, 2005 7:17 PM
> To: [email protected]
> Subject: [CFCDev] OT: Asynchronous processing on MX 6.1
> 
> Hi everyone,
> 
> I'm using cfhttp to request data from an external interface. It takes
> roughly 40/45 seconds but as the data increases the time taken will also
> increase.
> 
> It's an ideal situation use Coldfusion 7's Async Gatway but unfortunately
> the app is running on MX 6.1. Is it possible to do Asynchronous requests
> in
> Mx 6.1 and if so how?
> 
> Any ideas appreciated.

You can use CFSCHEDULE to mimic this (very poorly) as far back as CF 4.01.

Heck - isn't the asynch gateway only available in Enteprise anyway?  You may
need to mimic it in CF 7 as well.  ;^)

The big key here is some way to manage multiple tasks across many requests
(the same problem you have with the asynch gateway).  The application scope
makes this easy and using a common database can marshal the requests across
several servers in a cluster.

In any case there are several ways to do this:

1) Have a page run that launches a scheduled task (use a unique name) to
"run once".  The page that's launched would launch another and so on until
all the tasks were queued up.

2) In your marshalling system create a "token" system: a DB table or struct.
Each "token" would have a time stamp (allowing you to timeout "dead"
tokens).  Your system would first check to see if a token was available: if
so it launches the scheduled task directly.  If not it sets the scheduled
task to start in one minute (let's say) and repeat every minute (or five
minutes or whatever) until a token is available.

In this way you might have a bunch of pages checking but only a few doing
any serious work.  (Think of it like a weird, delayed CFLOCK).

3) If you have a lot of time you can just set the page to check if anything
needs to be done and, if there is, launch a scheduled task in five minutes.
That page would set another task to check in five minutes and then begin
working on part of the task.

Once a task is run that doesn't find any new work it can either delete the
task or just not create another (if that's the way you're doing it).

This works well for things like log file parsing over night: since each file
is being parsed by a different request any one of them can fail without
causing all of them to fail.

Jim Davis






----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to