Isnt that the whole problem, you have to wait for the async request to return before you can do anything? Probably the best thing to do is fire-and-forget the async request, have it update the DB and then later use AJAX to display it when the DB is populated (using AJAX was noted previously, this sounds like a good approach).
/cody -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, November 11, 2005 12:25 PM To: [email protected] Subject: RE: [CFCDev] Asynchronous Process When you launch a Asychronous process in CF7 you pass a structure. Within the asynchronous gateway you can modify that structure and update its value. That structure can then be access from the calling page. I haven't done this in a few months so forgive the roughness but in pseudocode its something like this... x = structNew() x.status = 'search' SendGatewayMessage("Asynch Logger", x); if x.status = 'done' { "Hey I'm done" } the Async gateway component looks something like <cfcomponent> <cffunction name="onIncomingMessage" output="no"> <cfargument name="CFEvent" type="struct" required="yes"> <cfset var myQuery = 0> <cfquery name="myQuery"> select * from xyz </cfquery> <cfset arguments.CFEvent.result=myQuery> <cfset arguments.CFEvent.status = 'done'> </cffunction> </cfcomponent> Jason Cronk "Mehdi, Agha" <[EMAIL PROTECTED] To: [email protected] om> cc: Sent by: Subject: RE: [CFCDev] Asynchronous Process [EMAIL PROTECTED] one.org 11/11/2005 02:48 PM Please respond to CFCDev We’re using CF 7 Ent. I guess I’m not clear as to how to read from an asynchronous process. Writing to the process is easy. Just submit it to the asynchronous thread and forget about it but what happens when you need to read back from the asynchronous thread and your request ends before the response gets back from it. Also, please throw some suggestions to implement Session Management in clustered environment. Thanks Agha Mehdi IDT - eBusiness Program Manager From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Davis Sent: Friday, November 11, 2005 11:33 AM To: [email protected] Subject: RE: [CFCDev] Asynchronous Process It really depends on the version of CF. If you’re on CF 7 Enterprise you can easily do this using the Asynch Gateways feature. If you’re on CF 7 Standard you can spend some time visualizing Macromedia burning in hellfire for making the decision that Asynch gateways were “Enterprise Only”. Hold that image for a minute. Cherish it. Smile. Now continue to explore any of the not-so-great options we’ve been stuck with this to do this: launching scheduled tasks programmatically, launching server-side programs with “cfexecute” or writing custom JavaCode. If you’re on CFMX 6 or earlier then you’ll be stuck with the not-so-great options while you wonder how in the hell you can convince corporate management to upgrade to CF 7 Enterprise just for Asynch gateways. My personal preference has been using CFSCHEDULE to launch the process. It’s easy, but I’ve never needed to test it for scalability. Jim Davis From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mehdi, Agha Sent: Friday, November 11, 2005 1:41 PM To: [email protected] Subject: [CFCDev] Asynchronous Process Hi all, I need to implement asynchronous process for a small piece on our website. It's rating system where the web site needs to pull in previous rating of the user. We have almost 300K records in the database and it affects the performance. How should I best implement it so that the request doesn't have to wait for this process to finish before it can move forward? One more thing. What is the best way to manage Sessions in a clustered environment? Thanks Agha Mehdi IDT - eBusiness Program Manager Work: 408.284.8239 Cell : 209.275.0482 Fax : 408.284.2766 ---------------------------------------------------------- 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). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] b.n+qׯNrzǧuޙqׯq3w"a{ +v˧ryuڲ^yh~^zf!B ⲻo '{0q3wv˩yUǢb0-x`'j!~^Pzbجjyp Vry&u}+ ---------------------------------------------------------- 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). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
