• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

adding CFC timeout?

New Here ,
Dec 03, 2007 Dec 03, 2007

Copy link to clipboard

Copied

iam trying add a timeout in a CFC but having some issues with it...I need help...here is my sample CFC which needs a timeout added....could somebody please help me how to add a timeout in the code..i tried requesttimeout using cfsetting but i could not pull WSDL up..

<cfsetting requesttimeout="30" />
<cfcomponent>
<cffunction name = "test" access="remote" returntype="struct" output="no">

<cfargument name="var1" required="true">
<cfargument name="var2" required="true">
<cfscript>
//Request structure
stOrder = structNew();
stOrder.var11 = #arguments.var1#;
stOrder.var21 = #arguments.var1#;

//needs a timeout added around this call
ws = createObject("webservice", "#WebServiceURL#");
myReturnVar = ws.NewOrder(stOrder); //end of timeout

</cfscript>
<CFSET returnStruct = StructNew()>
<CFSET structRC = StructInsert(returnStruct, "output", myReturnVar.outputvar1)>
<cfreturn returnStruct>
</cffunction>
</cfcomponent>
TOPICS
Advanced techniques

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 18, 2010 Feb 18, 2010

Copy link to clipboard

Copied

Did you find out any solution to resolve this issue? I am also facing similar type of issue.

Thanks

Anbu

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 18, 2010 Feb 18, 2010

Copy link to clipboard

Copied

Are you trying to CHANGE the request time out or have it delay for a certain period of time?

The cfsetting just changes the request time out ie allows the page to wait longer for it to load before throwing a timeout error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 18, 2010 Feb 18, 2010

Copy link to clipboard

Copied

In a CFC, all the code must be within the <cfcomponent> tags.  This is perhaps not immediately clear in the docs.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 20, 2010 Feb 20, 2010

Copy link to clipboard

Copied

Hi Adam,

Thanks for your response. I just want to throw the CFC an timeout error if it takes longer time. I have a CFC which runs very long and it hangs up the server. So I want the CFC to throw an timeout or error at some short interval.

Please help me out in resolving this issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 20, 2010 Feb 20, 2010

Copy link to clipboard

Copied

Read the sample code in the first post.  Then read Adam's first sentence.  Then look at the sample code again.  Anything jump out at you?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2010 Feb 22, 2010

Copy link to clipboard

Copied

adding CFC timeout?

No, I wouldn't. When my employer sends me to get a job done, he is the one with the stop-watch in his hand, not me.

In my opinion, the calling page should be the one to decide that a function is taking too long, not the component. I would design it like this:

callingPage.cfm

=============

<cfsetting requesttimeout="30" />

<!--- instantiate component or web service and call test() --->

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2010 Feb 22, 2010

Copy link to clipboard

Copied

LATEST

This is a good point.  The only time I would vary this advise is if the CFC method was being called directly / remotely.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation