Hi Robin,
That's an interesting suggestion... In trying to get my head around this I've got a couple of questions...
If this is accessed as a custom tag then I'll need to add the webroot to the custom tag directories, yes? Is that a good thing?
The implication I take away from this is that the cfhttp call will 'return' without waiting for the cfinvoke call to complete. Is that the case? And if so then why will it do that?
Thanks for taking the time, and to everyone else who chipped in.
Brett B)
Robin Hilliard wrote:
Brett Payne-Rhodes wrote:
Happy New Year to you all!
Does anyone have a simple mechanism for queueing/delaying tasks for later execution?
The scenario is that the user will request a task to be executed but that task will be long running and I want it to happen seperately to the users session. If I have to I can probably create and delete one-off tasks in the CF task scheduler (anyone have a code snippet for that?) but I was hoping there was a simpler way...
Brett I haven't tried this out but something like this could work. Create asyncinvoke.cfm under your webroot:
<cfif isdefined("attributes") and thisTag.executionMode eq "start">
<!--- We have been called as a custom tag, save the attributes in a unique location ---> <cfset uuid = createUUID()> <cfset server["asyncinvoke" & uuid] = attributes>
<!--- ...and create a separate request to make the call ---> <cfhttp method="get" url="http://127.0.0.1/asyncinvoke.cfm?attributeskey=#uuid#">
<cfelseif cgi.REMOTE_ADDR eq "127.0.0.1" and structKeyExists(url, "attributeskey")>
<!--- We have been called via HTTP request from the custom tag, get the attributes ---> <cfset attributes = server["asyncinvoke" & url.attributeskey]> <cfset structDelete(server, "asyncinvoke" & url.attributeskey)>
<!--- And make the original call ---> <cfinvoke argumentcollection=#attributes#>
</cfif>
You'll need to tweak the cfinvoke. You could use this tag in place of cfinvoke to have the cfc method execute in a separate request.
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
-- Brett Payne-Rhodes Eaglehawk Computing t: +61 (0)8 9371-0471 f: +61 (0)8 9371-0470 m: +61 (0)414 371 047 e: [EMAIL PROTECTED] w: www.ehc.net.au
--- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
