Friday, 5 June 2015

CFSCHEDULE & Scheduled Taks

Hi,

I came to know some nice functions of Scheduled Tasks and  CFSHEDULE.

I had a task like the Records will get fetch from DB, there will be a huge number of records. Have to send records through HTTP, but the records sending should be as fast as possible. With one file I couldn't make that so I used 3 files which gets Query result from parent page and executes. I used the chained task feature in CF Admin Scheduled Tasks and CFSHEDULE run action.

cfschedule

The task should be set up in CFADMIN before using through CFSCHEDULE.

Used to run the already defined scheduled task. It will run in real time.
 <cfschedule action="run" task="scheduledTask2" >  

To pause all the task, only 'pause' can be used to pause a specific task.
 <cfschedule action="pauseall">  

To update the existing task we can use UPDATE action. We can set most of the settings through Update action.
 <cfschedule action="update" repeat="2" onmisfire="FIRE_NOW" url='http://localhost/ColdfusionDemo/Practise/scheduledTask1.cfm'   
      startdate="#createDate(2015,6,05)#" starttime="10:00 PM" enddate="#createDate(2015,6,05)#" endtime="11:00 PM" interval="once" task="scheduledTask1">  

To list Scheduled task we can use LIST action, we get query object as a result having all settings.
 <cfschedule action="list" task="scheduledTask1,scheduledTask2" result="res">  
 <cfdump var="#res#" >  

Other actions are DELETE,RESUME,RESMUE ALL

Note:
1. The paused tasks can't be run through RUN action.
2. The chained tasks cannot be paused or resumed through PAUSE ALL, PAUSE, RESUME or               RESUME  ALL action.
3. Except On Chained, On Complete and Daily Every sections other sections can be set through UPDATE action.

Scheduled Tasks



We can set Scheduled tasks in Admin Server Settings->Scheduled Tasks.

Scheduled Task panel












In this we can set Task Name,URL and other settings.














The Most of Options in Settings are self explanatory.


  • ScheduledTask1 is a child Task of ScheduledTask2. ScheduledTask1 will run after completion of ScheduledTask2. 
  • We can publish the output in .txt or .log file. By choosing Publish.
  • Cluster is for Enabling to Execute tasks in Cluster Setup.

One can refer through each settings in detail at Right Side Upper Help Button in CF Admin.