Re: Threaded cfhttp example
Here try this. I snipped it out of something I use to build static pages with CFHTTP. It builds thousands of them based on query output. I wanted it to run multiple threads at once but not so many it fried CF. So the code keeps track of how many threads are running and limits their number to a value you specify. variables.threadcount sets the number of threads to allow to run concurrently. For your routine you could have the urls you want to canvas in a db, query them as seen below and then reference the query output's current row in the loop via the loopCounter variable as shown. variables.threadArray=arrayNew(1); variables.threadCount=3; SELECT fileName.primaryKey FROM fileName WHERE 0=0 ORDER BY fileName.primaryKey ASC -- --m@Robertson-- Janitor, The Robertson Team mysecretbase.com ~| 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:360142 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Threaded cfhttp example
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. http://www.google.com"; name="t1"> http://www.google.com"; name="t2"> Byron On Mon, Feb 16, 2015 at 7:57 AM, Michael Christensen 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
Threaded cfhttp example
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:360120 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm