RE: Send response to browser, but continue working on request?

2001-12-12 Thread Lon Lentz

  Sorry for my nondescript answer yesterday but I didn't have the exact 
answer in front of me.

  Use cfhttp in your kickstart template to make a post to the action 
template with a timeout=1.


 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 11, 2001 4:07 PM
 To: CF-Talk
 Subject: RE: Send response to browser, but continue working on 
request?
 
 
 Thanks, that sounds good, but I was hoping to not have to use 
CFSCHEDULE.
 
 Any other ideas?
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-12 Thread Tony Schreiber

CFHTTP with a timeout of 1? Hmm. I got it working with CFEXECUTE (Timeout
0), but ultimately CFHTTP may be easier to use (because I can pump some
cookie variables into it)...

   Sorry for my nondescript answer yesterday but I didn't have the exact
 answer in front of me.

   Use cfhttp in your kickstart template to make a post to the action
 template with a timeout=1.


  -Original Message-
  From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 11, 2001 4:07 PM
  To: CF-Talk
  Subject: RE: Send response to browser, but continue working on
 request?
 
 
  Thanks, that sounds good, but I was hoping to not have to use
 CFSCHEDULE.
 
  Any other ideas?
 
~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-12 Thread Lon Lentz

 
  I don't know how this will work if you are running both templates on 
the same server. We had the kickstart template on the webserver and the 
action template on a different machine.


 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 12, 2001 10:28 AM
 To: CF-Talk
 Subject: RE: Send response to browser, but continue working on 
request?
 
 
 CFHTTP with a timeout of 1? Hmm. I got it working with CFEXECUTE 
(Timeout
 0), but ultimately CFHTTP may be easier to use (because I can pump 
some
 cookie variables into it)...
 
Sorry for my nondescript answer yesterday but I didn't have the 
exact
  answer in front of me.
 
Use cfhttp in your kickstart template to make a post to the action
  template with a timeout=1.
 
 
   -Original Message-
   From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, December 11, 2001 4:07 PM
   To: CF-Talk
   Subject: RE: Send response to browser, but continue working on
  request?
  
  
   Thanks, that sounds good, but I was hoping to not have to use
  CFSCHEDULE.
  
   Any other ideas?
  
 
~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Raymond Camden

If you are running CF5, just use CFFLUSH.

Sample:
...
Hey, I'm doing a bunch of junk, please stand by
CFFLUSH

CFREALSLOWTHING



===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, December 11, 2001 10:17 AM
 To: CF-Talk
 Subject: Send response to browser, but continue working on request?
 
 
 I have a function that allows a user to create a file of available
 inventory. The problem is that it takes a long time and eventually the
 browser will timeout, but they haven't gotten their file yet...
 
 What I want to do is let the user make the request and then 
 respond with
 Thank you for your request. Your file will be created and 
 emailed to you
 shortly.
 
 How can I spawn off the part that will actually create the file and
 still respond with a finished request to the browser?
 
 
 Tony Schreiber, Senior Partner  Man and 
 Machine, Limited
 mailto:[EMAIL PROTECTED]   
 http://www.technocraft.com
 
http://www.simplemessageboard.com 
___Free Forum Software for Cold Fusion
http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
http://www.digitacamera.com __DigitA Camera Scripts and Tips
http://www.linklabexchange.com _Miata Link ECU Data Exchange

~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Send response to browser, but continue working on request?

2001-12-11 Thread David Schmidt

Have you tried cfflush?  I believe this tag will allow you to send partial
responses to the browser.  I might have spelled it wrong, but I am sure
there is a function in CF.

David


- Original Message -
From: Tony Schreiber [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, December 11, 2001 7:17 AM
Subject: Send response to browser, but continue working on request?


 I have a function that allows a user to create a file of available
 inventory. The problem is that it takes a long time and eventually the
 browser will timeout, but they haven't gotten their file yet...

 What I want to do is let the user make the request and then respond with
 Thank you for your request. Your file will be created and emailed to you
 shortly.

 How can I spawn off the part that will actually create the file and
 still respond with a finished request to the browser?


 Tony Schreiber, Senior Partner  Man and Machine, Limited
 mailto:[EMAIL PROTECTED]   http://www.technocraft.com

 http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
 http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
 http://www.digitacamera.com __DigitA Camera Scripts and Tips
 http://www.linklabexchange.com _Miata Link ECU Data Exchange
 
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Send response to browser, but continue working on request?

2001-12-11 Thread Tony Schreiber

That let's me get a message to the browser, but the request is still
running and the browser is still waiting...

I want to browser to stop waiting...

 Have you tried cfflush?  I believe this tag will allow you to send partial
 responses to the browser.  I might have spelled it wrong, but I am sure
 there is a function in CF.

 David


 - Original Message -
 From: Tony Schreiber [EMAIL PROTECTED]
 To: CF-Talk [EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2001 7:17 AM
 Subject: Send response to browser, but continue working on request?


  I have a function that allows a user to create a file of available
  inventory. The problem is that it takes a long time and eventually the
  browser will timeout, but they haven't gotten their file yet...
 
  What I want to do is let the user make the request and then respond with
  Thank you for your request. Your file will be created and emailed to you
  shortly.
 
  How can I spawn off the part that will actually create the file and
  still respond with a finished request to the browser?
 
 
  Tony Schreiber, Senior Partner  Man and Machine, Limited
  mailto:[EMAIL PROTECTED]   http://www.technocraft.com
 
  http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
  http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
  http://www.digitacamera.com __DigitA Camera Scripts and Tips
  http://www.linklabexchange.com _Miata Link ECU Data Exchange
 
 
~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Send response to browser, but continue working on request?

2001-12-11 Thread Jochem van Dieten

Tony Schreiber wrote:

 That let's me get a message to the browser, but the request is still
 running and the browser is still waiting...
 
 I want to browser to stop waiting...


Could you send some javascript to the browser with CFFLUSH that does a 
redirect?

script language=javascript
window.location = thankyou.cfm;
/script

Jochem
~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Dunwiddie, Bruce

you are wanting the browser to make a request for a file but not wait for
the file to be retrieved? if so, I don't think that's feasible. a general
solution for the problem of generating the email would be to have a img
src=createfile.cfm that can send out the email and you can show them
whatever message you'd like to show them and the browser waiting for more
should have no effect on the cfm or on the user.

-Original Message-
From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 11, 2001 9:33 AM
To: CF-Talk
Subject: Re: Send response to browser, but continue working on request?


That let's me get a message to the browser, but the request is still
running and the browser is still waiting...

I want to browser to stop waiting...

 Have you tried cfflush?  I believe this tag will allow you to send partial
 responses to the browser.  I might have spelled it wrong, but I am sure
 there is a function in CF.

 David


 - Original Message -
 From: Tony Schreiber [EMAIL PROTECTED]
 To: CF-Talk [EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2001 7:17 AM
 Subject: Send response to browser, but continue working on request?


  I have a function that allows a user to create a file of available
  inventory. The problem is that it takes a long time and eventually the
  browser will timeout, but they haven't gotten their file yet...
 
  What I want to do is let the user make the request and then respond with
  Thank you for your request. Your file will be created and emailed to
you
  shortly.
 
  How can I spawn off the part that will actually create the file and
  still respond with a finished request to the browser?
 
 
  Tony Schreiber, Senior Partner  Man and Machine, Limited
  mailto:[EMAIL PROTECTED]   http://www.technocraft.com
 
  http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
  http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
  http://www.digitacamera.com __DigitA Camera Scripts and Tips
  http://www.linklabexchange.com _Miata Link ECU Data Exchange
 
 

~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread mherbene

Perhaps you could use the CFSCHEDULE tag to programmatically schedule a job
to run (soon) which generates the file and sends the email?  Then the page
that the user sees will be done as soon as the job is scheduled (should be
quick).  Though some people hate CFSCHEDULE and I haven't used it much.

 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 11, 2001 10:33 AM
 To: CF-Talk
 Subject: Re: Send response to browser, but continue working 
 on request?
 
 
 That let's me get a message to the browser, but the request is still
 running and the browser is still waiting...
 
 I want to browser to stop waiting...
 
  Have you tried cfflush?  I believe this tag will allow you 
 to send partial
  responses to the browser.  I might have spelled it wrong, 
 but I am sure
  there is a function in CF.
 
  David
 
 
  - Original Message -
  From: Tony Schreiber [EMAIL PROTECTED]
  To: CF-Talk [EMAIL PROTECTED]
  Sent: Tuesday, December 11, 2001 7:17 AM
  Subject: Send response to browser, but continue working on request?
 
 
   I have a function that allows a user to create a file of available
   inventory. The problem is that it takes a long time and 
 eventually the
   browser will timeout, but they haven't gotten their file yet...
  
   What I want to do is let the user make the request and 
 then respond with
   Thank you for your request. Your file will be created 
 and emailed to you
   shortly.
  
   How can I spawn off the part that will actually create 
 the file and
   still respond with a finished request to the browser?
  
  
   Tony Schreiber, Senior Partner  Man and 
 Machine, Limited
   mailto:[EMAIL PROTECTED]   
http://www.technocraft.com
 
  http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
  http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
  http://www.digitacamera.com __DigitA Camera Scripts and Tips
  http://www.linklabexchange.com _Miata Link ECU Data Exchange
 
 

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Michael Haggerty

Tony; 

The scheme I used in the past to do something similar was the following.
Please keep in mind this is pre-version 5 and may no longer be the best
practice. 

1) Update a database with the user's id and the details on the page to
generate (any variables passed, etc.). Display a page explaining the user
will receive an email with download instructions.

2) CFSCHEDULE the page to generate the report ON ANOTHER BOX so you won't
bog down a production server with long running pages. Set the timeout on
this template to serve your needs. Make sure you use CFERROR or CFCATCH to
monitor the template's progress. It is a good idea to set yourself up to be
notified in case of errors. 

3) Use CFFILE to create the file and store the file name and path in a
database for later removal. 

4) Update the database to indicate the page has generated or Delete the
record to remove it from the queue.

5) CFMAIL the client download instructions on successful creation of the
file. Tell the user how long they will have to download the file. You may
wish to have the client download the page via CFCONTENT and have some error
handling set up at this stage to avoid any snafus.

6) CFSCHEDULE another page to delete old files using the information stored
in step 3. No need to keep reports that have already been created. 

Good luck,
Mike

-Original Message-
From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 11, 2001 10:17 AM
To: CF-Talk
Subject: Send response to browser, but continue working on request?


I have a function that allows a user to create a file of available
inventory. The problem is that it takes a long time and eventually the
browser will timeout, but they haven't gotten their file yet...

What I want to do is let the user make the request and then respond with
Thank you for your request. Your file will be created and emailed to you
shortly.

How can I spawn off the part that will actually create the file and
still respond with a finished request to the browser?


Tony Schreiber, Senior Partner  Man and Machine, Limited
mailto:[EMAIL PROTECTED]   http://www.technocraft.com

http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
http://www.digitacamera.com __DigitA Camera Scripts and Tips
http://www.linklabexchange.com _Miata Link ECU Data Exchange

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Tony Schreiber

Thanks, that sounds good, but I was hoping to not have to use CFSCHEDULE.

Any other ideas?

 The scheme I used in the past to do something similar was the following.
 Please keep in mind this is pre-version 5 and may no longer be the best
 practice.

 1) Update a database with the user's id and the details on the page to
 generate (any variables passed, etc.). Display a page explaining the user
 will receive an email with download instructions.

 2) CFSCHEDULE the page to generate the report ON ANOTHER BOX so you won't
 bog down a production server with long running pages. Set the timeout on
 this template to serve your needs. Make sure you use CFERROR or CFCATCH to
 monitor the template's progress. It is a good idea to set yourself up to be
 notified in case of errors.

 3) Use CFFILE to create the file and store the file name and path in a
 database for later removal.

 4) Update the database to indicate the page has generated or Delete the
 record to remove it from the queue.

 5) CFMAIL the client download instructions on successful creation of the
 file. Tell the user how long they will have to download the file. You may
 wish to have the client download the page via CFCONTENT and have some error
 handling set up at this stage to avoid any snafus.

 6) CFSCHEDULE another page to delete old files using the information stored
 in step 3. No need to keep reports that have already been created.

 Good luck,
 Mike

 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 11, 2001 10:17 AM
 To: CF-Talk
 Subject: Send response to browser, but continue working on request?


 I have a function that allows a user to create a file of available
 inventory. The problem is that it takes a long time and eventually the
 browser will timeout, but they haven't gotten their file yet...

 What I want to do is let the user make the request and then respond with
 Thank you for your request. Your file will be created and emailed to you
 shortly.

 How can I spawn off the part that will actually create the file and
 still respond with a finished request to the browser?


 Tony Schreiber, Senior Partner  Man and Machine, Limited
 mailto:[EMAIL PROTECTED]   http://www.technocraft.com

 http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
 http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
 http://www.digitacamera.com __DigitA Camera Scripts and Tips
 http://www.linklabexchange.com _Miata Link ECU Data Exchange

 
~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Tony Schreiber

No, I want the browser to request a page that returns immediately (so the
broswer isn't waiting for a request to be completed and ultimately time
out), but spawns a long-running request that will create the requested
file and then email it to the user...

I think the previously posted javascript/cfflush might work...

 you are wanting the browser to make a request for a file but not wait for
 the file to be retrieved? if so, I don't think that's feasible. a general
 solution for the problem of generating the email would be to have a img
 src=createfile.cfm that can send out the email and you can show them
 whatever message you'd like to show them and the browser waiting for more
 should have no effect on the cfm or on the user.

 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 11, 2001 9:33 AM
 To: CF-Talk
 Subject: Re: Send response to browser, but continue working on request?


 That let's me get a message to the browser, but the request is still
 running and the browser is still waiting...

 I want to browser to stop waiting...

  Have you tried cfflush?  I believe this tag will allow you to send partial
  responses to the browser.  I might have spelled it wrong, but I am sure
  there is a function in CF.
 
  David
 
 
  - Original Message -
  From: Tony Schreiber [EMAIL PROTECTED]
  To: CF-Talk [EMAIL PROTECTED]
  Sent: Tuesday, December 11, 2001 7:17 AM
  Subject: Send response to browser, but continue working on request?
 
 
   I have a function that allows a user to create a file of available
   inventory. The problem is that it takes a long time and eventually the
   browser will timeout, but they haven't gotten their file yet...
  
   What I want to do is let the user make the request and then respond with
   Thank you for your request. Your file will be created and emailed to
 you
   shortly.
  
   How can I spawn off the part that will actually create the file and
   still respond with a finished request to the browser?
  
  
   Tony Schreiber, Senior Partner  Man and Machine, Limited
   mailto:[EMAIL PROTECTED]   http://www.technocraft.com
  
   http://www.simplemessageboard.com ___Free Forum Software for Cold Fusion
   http://www.is300.net ___The Enthusiast's Home of the Lexus IS300
   http://www.digitacamera.com __DigitA Camera Scripts and Tips
   http://www.linklabexchange.com _Miata Link ECU Data Exchange
  
 

 
~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Andrew Tyrone

Tony,

I don't know what OS/platform you are using, but CFEXECUTE should do what
you want.

Recently I was working on this exact problem.  The application is a content
management system for an advertising agency.  When Jobs are updated,
sometimes HUGE files need to be moved, hundreds of megabytes in fact.  The
best way I found to do this was to spawn a batch file with cfexecute, set
the timeout to 0, which is a non-blocking mode of execution.  This means the
process will run in the background and return control to the browser right
away.

The batch file can execute a ColdFusion template that will do the requested
file manipulation, OR you can use your operation system's native file
commands and then send the execution to a ColdFusion template to send the
email confirmation.

The possibilities are somewhat large if not endless.  What I've done is take
this process and update a database field, effectively locking access to
parts of the Job until file executions are done.  You can even create a
queue for pending file operations in this way!

Also, another trick you can do is to execute the cf templates from the batch
file with the user's session id, namely cfid and cftoken.  In addition, if
they have to log in, you can have a page where they can go to view the
status of the file operations in progress, merely by reading a value from
the database.

You have to be careful because you can run into some problems when you get
this granular.  An example would be a process that is spawned goes off into
never-never land.  This is why there should be some kind of reporting for
long running spawned processes.  There are many ways to accomplish that,
though.

Have fun!

Andy

 -Original Message-
 From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 11, 2001 4:10 PM
 To: CF-Talk
 Subject: RE: Send response to browser, but continue working on request?


 No, I want the browser to request a page that returns immediately (so the
 broswer isn't waiting for a request to be completed and ultimately time
 out), but spawns a long-running request that will create the requested
 file and then email it to the user...

 I think the previously posted javascript/cfflush might work...

  you are wanting the browser to make a request for a file but
 not wait for
  the file to be retrieved? if so, I don't think that's feasible.
 a general
  solution for the problem of generating the email would be to have a img
  src=createfile.cfm that can send out the email and you can show them
  whatever message you'd like to show them and the browser
 waiting for more
  should have no effect on the cfm or on the user.
 
  -Original Message-
  From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 11, 2001 9:33 AM
  To: CF-Talk
  Subject: Re: Send response to browser, but continue working on request?
 
 
  That let's me get a message to the browser, but the request is still
  running and the browser is still waiting...
 
  I want to browser to stop waiting...
 
   Have you tried cfflush?  I believe this tag will allow you to
 send partial
   responses to the browser.  I might have spelled it wrong, but
 I am sure
   there is a function in CF.
  
   David
  
  
   - Original Message -
   From: Tony Schreiber [EMAIL PROTECTED]
   To: CF-Talk [EMAIL PROTECTED]
   Sent: Tuesday, December 11, 2001 7:17 AM
   Subject: Send response to browser, but continue working on request?
  
  
I have a function that allows a user to create a file of available
inventory. The problem is that it takes a long time and
 eventually the
browser will timeout, but they haven't gotten their file yet...
   
What I want to do is let the user make the request and then
 respond with
Thank you for your request. Your file will be created and
 emailed to
  you
shortly.
   
How can I spawn off the part that will actually create
 the file and
still respond with a finished request to the browser?
   
   
Tony Schreiber, Senior Partner  Man and
 Machine, Limited
mailto:[EMAIL PROTECTED]
 http://www.technocraft.com
   
http://www.simplemessageboard.com ___Free Forum Software
 for Cold Fusion
http://www.is300.net ___The Enthusiast's Home of
 the Lexus IS300
http://www.digitacamera.com __DigitA Camera
 Scripts and Tips
http://www.linklabexchange.com _Miata Link ECU
 Data Exchange
   
  
 
 
 
~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Send response to browser, but continue working on request?

2001-12-11 Thread Tony Schreiber

I didn't know you could do that with CFEXECUTE, that sounds like it will
work perfectly. I can simply use cfexecute to initiate the cf template
that generates the file... Very cool.

 I don't know what OS/platform you are using, but CFEXECUTE should do what
 you want.

 Recently I was working on this exact problem.  The application is a content
 management system for an advertising agency.  When Jobs are updated,
 sometimes HUGE files need to be moved, hundreds of megabytes in fact.  The
 best way I found to do this was to spawn a batch file with cfexecute, set
 the timeout to 0, which is a non-blocking mode of execution.  This means the
 process will run in the background and return control to the browser right
 away.

 The batch file can execute a ColdFusion template that will do the requested
 file manipulation, OR you can use your operation system's native file
 commands and then send the execution to a ColdFusion template to send the
 email confirmation.

 The possibilities are somewhat large if not endless.  What I've done is take
 this process and update a database field, effectively locking access to
 parts of the Job until file executions are done.  You can even create a
 queue for pending file operations in this way!

 Also, another trick you can do is to execute the cf templates from the batch
 file with the user's session id, namely cfid and cftoken.  In addition, if
 they have to log in, you can have a page where they can go to view the
 status of the file operations in progress, merely by reading a value from
 the database.

 You have to be careful because you can run into some problems when you get
 this granular.  An example would be a process that is spawned goes off into
 never-never land.  This is why there should be some kind of reporting for
 long running spawned processes.  There are many ways to accomplish that,
 though.

 Have fun!

 Andy

  -Original Message-
  From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 11, 2001 4:10 PM
  To: CF-Talk
  Subject: RE: Send response to browser, but continue working on request?
 
 
  No, I want the browser to request a page that returns immediately (so the
  broswer isn't waiting for a request to be completed and ultimately time
  out), but spawns a long-running request that will create the requested
  file and then email it to the user...
 
  I think the previously posted javascript/cfflush might work...
 
   you are wanting the browser to make a request for a file but
  not wait for
   the file to be retrieved? if so, I don't think that's feasible.
  a general
   solution for the problem of generating the email would be to have a img
   src=createfile.cfm that can send out the email and you can show them
   whatever message you'd like to show them and the browser
  waiting for more
   should have no effect on the cfm or on the user.
  
   -Original Message-
   From: Tony Schreiber [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, December 11, 2001 9:33 AM
   To: CF-Talk
   Subject: Re: Send response to browser, but continue working on request?
  
  
   That let's me get a message to the browser, but the request is still
   running and the browser is still waiting...
  
   I want to browser to stop waiting...
  
Have you tried cfflush?  I believe this tag will allow you to
  send partial
responses to the browser.  I might have spelled it wrong, but
  I am sure
there is a function in CF.
   
David
   
   
- Original Message -
From: Tony Schreiber [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, December 11, 2001 7:17 AM
Subject: Send response to browser, but continue working on request?
   
   
 I have a function that allows a user to create a file of available
 inventory. The problem is that it takes a long time and
  eventually the
 browser will timeout, but they haven't gotten their file yet...

 What I want to do is let the user make the request and then
  respond with
 Thank you for your request. Your file will be created and
  emailed to
   you
 shortly.

 How can I spawn off the part that will actually create
  the file and
 still respond with a finished request to the browser?


 Tony Schreiber, Senior Partner  Man and
  Machine, Limited
 mailto:[EMAIL PROTECTED]
  http://www.technocraft.com

 http://www.simplemessageboard.com ___Free Forum Software
  for Cold Fusion
 http://www.is300.net ___The Enthusiast's Home of
  the Lexus IS300
 http://www.digitacamera.com __DigitA Camera
  Scripts and Tips
 http://www.linklabexchange.com _Miata Link ECU
  Data Exchange

   
  
  
 
 
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: