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

Background Processes

Engaged ,
Feb 05, 2008 Feb 05, 2008

Copy link to clipboard

Copied

I have a form that requires a user to input about 40 datapoints. Once they submit the form, the 40 datapoints are inserted into our database, calculations are run on the data, and more data is inserted in the database. When all the data is in, an email is sent to the user and then the page reloaded with the entered data pre-filled in.

Is there any way to, once they submit the data, have all the insertions and calculations and emailing go on in a seperate process while they move on and do other things? Obviously scheduled tasks are done in the background, but they are using a different session.

Could I do a cflocation then then cfmodule and call the data submission template?

Ideas are welcome, thanks!
TOPICS
Advanced techniques

Views

369

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

correct answers 1 Correct answer

LEGEND , Feb 05, 2008 Feb 05, 2008
> Obviously scheduled tasks are
> done in the background, but they are using a different session. Could I do a
> cflocation then then cfmodule and call the data submission template? Ideas are
> welcome, thanks!

Crikey. Nothing as complicated as all that.

Just use CFTHREAD:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_t_04.html

(or on pre-CF8, use the async gateway).

--
Adam

Votes

Translate

Translate
Mentor ,
Feb 05, 2008 Feb 05, 2008

Copy link to clipboard

Copied

I do something similar to this all the time on my application that uses Oracle. You could have the gui prompt the user to submit the 40 datapoints via forms, etc., and populate a table in the database with the data and a status of 'submitted' etc. Then, I would have a background process (stored procedure, etc.) that runs every 'x' minutes which scans for work to do by looking for the submitted status. The stored procedure would then perform whatever activity that you wish on the pending jobs, then end by setting the job status to 'complete', or 'error', or whatever you want to use to track completed or failed jobs. Your client can then check to see if his or her job completed by accessing a page that check the status of the submitted job, etc. Works great, especially if you have process that take too long to hold up a web page.

Phil

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
Participant ,
Feb 05, 2008 Feb 05, 2008

Copy link to clipboard

Copied

Pure server-side:
============
1. Receive form.
2. Execute CFHTTP with form fields using timeout 0 to "background" template. Ignore timeout error.
3. Continue (redirect, if you wish)

Client-side (may vary, but this is an idea):
=============================
1. Create invisible frame.
2. When user hit "Submit" use JScript to grab parameters and submit 2 forms: one for background, another to continue.

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 05, 2008 Feb 05, 2008

Copy link to clipboard

Copied

> Obviously scheduled tasks are
> done in the background, but they are using a different session. Could I do a
> cflocation then then cfmodule and call the data submission template? Ideas are
> welcome, thanks!

Crikey. Nothing as complicated as all that.

Just use CFTHREAD:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_t_04.html

(or on pre-CF8, use the async gateway).

--
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
Engaged ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

LATEST
Thank you everyone!

I think Adam's answer makes the most sense, especially since paross' idea was shot down when I suggested it to my boss a few days ago, but I'm glad I got that because it's always good to know your ideas are shared by people more knowledgeable that yourself.

I've done a little research and found cfthread to be exceptional, but I haven't found a way to do inline code. It works really well when a template is called though. I don't even know if it can do inline code. The livedocs suggest it can but Forta, Camden, etc. don't have examples like that.

I've posted a followup query here: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1335607&ente... in case anyone has any ideas. It's related, but I thought it merited a new thread 🙂

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