Copy link to clipboard
Copied
On a CF9 system which of the various Asynchronous options would the group-think consider the easiest and best to implement for the following purpose.
I have a file on one server that does some initial processing. When done sucessfully it posts a received file to another server. I want it to NOT wait for a response from that server. Rather I just want the request to finish and return an initial response to the client that contacted the first server.
Here is the code where The file is posted to an internal server.
<cftry>
<!--- Submit POST request to the internal server with to deliver the XML file --->
<cfhttp url="http://#application.internalServer#/pur-loader/ws/ppur_int_v0.cfc" method="post" multipart="yes" timeout="0">
<cfhttpparam name="incomingFile" type="file" file="#cffile.serverDirectory & '/' & cffile.serverFile#">
<cfhttpparam name="method" type="url" value="receiveData">
</cfhttp>
<cfcatch type="any">
<cflog application="yes" file="PPUR" type="error" text="HTTP Request to the Internal Web service failed.">
<cfrethrow>
</cfcatch>
</cftry>
I thought the timeout=0 was a very old method to generate an Asynchronous process. But, apparently I am wrong or this is no longer true. As this code does not work. The <cfhttp...> tag is waiting for a response and is timing out from the request time out not the http timeout, do to the interal process is going to take serverl minutes or more.
Would a <cfthread...> work well here? My concern in the number of threads that can be spawned. The initial template may be accessed upwards of 60 times in a relatively short time. Would creating 60ish long running threads with the <cfthread...> be of concern?
Would a gateway improve that situation in any way?
Are there other Asynchronous options I am overlooking?
Copy link to clipboard
Copied
your problem could be timeout="0"...i dont think it is a good idea to use zero...and <cfhttpparam is missing some pounds around variables...