This should get you started. The cfthread join waits the specific timeout
for the threads in the name list to finish.  If not all threads are
complete, things continue on, so you may want to perform checks against the
threads returned in cfthread to ensure the values exists, etc.

<cfthread action="run" aUrl="http://www.google.com"; name="t1">
<cfhttp method="get" url="#aUrl#" timeout='10' />
<cfset thread.rtn = cfhttp.fileContent.length()>
</cfthread>

<cfthread action="run" aUrl="http://www.google.com"; name="t2">
<cfhttp method="get" url="#aUrl#" timeout='10' />
<cfset thread.rtn = cfhttp.fileContent.length()>
</cfthread>

<cfthread action='join' name='t1,t2' timeout='5000'></cfthread>

<cfdump var="#cfthread#">

Byron



On Mon, Feb 16, 2015 at 7:57 AM, Michael Christensen <m...@travelmarket.com>
wrote:

>
> Hello Experts!
>
> I have been trying to create a multi-threaded cfhttp request script, but I
> have so far failed miserably.
>
> I want to run 10 concurrent threads that call URLS using cfhttp and I want
> to store the results (basically cfhttp.filecontent) in an array or a
> similar structure that I can loop once all threads have finished.
>
> Can someone provide me with a working example of this?
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:360121
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to