Pritesh Feb,08 2017
In my last post I have covered Group and list scheduler enhancement in ColdFusion 10. Today I have spent some time with event hander and other enhancement. In coldfusion 10 added new attribute mode which task application or server as value, this will let you specify task is server specific or application specific and default mode is server. Application specific task can be created from Application only and it will not be editable from ColdFusion administrator although you can run, pause or delete it from there.
Two new attribute action's value 'pauseall' and 'resumeall' can be use to pause/resume all task related to current application.
<cfschedule startDate="11/11/2011" starttime="12:01 AM" interval="Daily" action="update" task="MyGroupedTask" url="http://www.facebook.com" group="CallSocial" mode="application"/><cfschedule startDate="11/11/2011" starttime="12:01 AM" interval="Daily" action="update" task="MyGroupedTask1" url="http://www.twitter.com" group="CallSocial" mode="application"/><cfschedule action="pauseall" mode="application"/><cfschedule action="resumeall" mode="application"/>
In above code we have created two application level schedule tasks (notice mode = 'application') and later pause and resume both of them by just single command. If we do not specify mode attribute with pauseall/resumeall then it will take default value 'server' and perform operation on all server task. I think this is really nice feature when you have multiple application running in same server and do not want schedule task deleted/modify by other application due to name conflict.
Chaining is another nice enhancement where you can specify dependent task which will fire on completion of parent task. You just need to specify task that you want to chain with parent task. Format will be [task name]:[group name]:[server or application].
<cfschedule action="update" task="childtask" url="http://allmytest.local/cf10/day13/childschedule.cfm" mode="application"/><cfschedule startDate="11/11/2011" starttime="12:01 AM" interval="Daily" action="update" task="parenttask" url="http://allmytest.local/cf10/day13/parentschedule.cfm" mode="application" onComplete="childtask:DEFAULT:application" />
Task named 'ChildTask' will be used as chained task for task named 'parenttask'. Notice in first task I haven't specified any start date and time which was mandatory in ColdFusion 9. In CF10 if we do not specify start date and time it will be consider as chained task and only be called through chaining although you can specify date and time if you also want to run task separate from chaining.
Chaining will not work if parent task mode is server and child task from application.