Difference between revisions of "Scheduler"

From ADF Docs
Jump to: navigation, search
(Usage)
(Code Update - 2011-09-27)
Line 7: Line 7:
 
== Code Update - 2011-09-27 ==
 
== Code Update - 2011-09-27 ==
 
<pre>
 
<pre>
!!!! THIS CODE UPDATE WILL BREAK CURRENT SCHEDULER IMPLEMENTATIONS !!!!
+
!!!! CODE UPDATE WILL BREAK CURRENT SCHEDULER IMPLEMENTATIONS !!!!
 +
</pre>
  
 
Scheduler_1_0 Modifications:
 
Scheduler_1_0 Modifications:
  
 
application.schedule:  
 
application.schedule:  
a. The variable scope 'application.schedule' has been removed
+
#The variable scope 'application.schedule' has been removed
b. 'application.schedule' has been replaced with the variable scope application.ADFscheduler
+
#'application.schedule' has been replaced with the variable scope application.ADFscheduler
 
 
 
application.ADFscheduler:  
 
application.ADFscheduler:  
a. Updated the persistent schedule task variable name so it can be identified easier as a variable that was created by a component of the ADF.
+
#Updated the persistent schedule task variable name so it can be identified easier as a variable that was created by a component of the ADF.
b. To access the task information stored within the  ' application.ADFscheduler' variable from within your Apps and/or Site code it is a best practice to call the following Scheduler LIB method: application.ADF.scheduler.getSchedulerVars();
+
#To access the task information stored within the  ' application.ADFscheduler' variable from within your Apps and/or Site code it is a best practice to call the following Scheduler LIB method: application.ADF.scheduler.getSchedulerVars();
 
 
NOTE: Using this method call from within Apps and or Site Code will insure that your code remains compatible even if this variable changes again in the future.  
+
NOTE: Using the getSchedulerVars() method call from within Apps and Site Code will insure that your code remains compatible even if this variable changes again in the future.  
Also In the future this scheduler variable may be move to be included in a common variable scope location along with other application level ADF variables that are stored outside of the standard 'application.ADF' scope.  
+
Also In the future this scheduler variable may be move to be included in a common variable scope location along with other application level ADF variables that are stored outside of the standard 'application.ADF' scope.  
 
 
It is recommended that you update any App code that uses the Scheduler to reflect these changes before the ADF 1.5 truck code is updated with these updates.
+
*It is recommended that you update any App code that uses the Scheduler to reflect these changes before the ADF 1.5 truck code is updated with these updates.
  
When the ADF 1.5 trunk is updated to include these changes it is also recommended that you update any Customers that use the Scheduler components in Apps or in Site code to reflect these updates.
+
*When the ADF 1.5 trunk is updated to include these changes it is also recommended that you update any Customers that use the Scheduler components in Apps or in Site code to reflect these updates.
</pre>
 
  
 
== Usage ==
 
== Usage ==

Revision as of 16:53, 27 September 2011


Attention: Do not change any text in the description, properties, and functions sections.

Return to Library (API)

Code Update - 2011-09-27

!!!! CODE UPDATE WILL BREAK CURRENT SCHEDULER IMPLEMENTATIONS !!!!

Scheduler_1_0 Modifications:

application.schedule:

  1. The variable scope 'application.schedule' has been removed
  2. 'application.schedule' has been replaced with the variable scope application.ADFscheduler

application.ADFscheduler:

  1. Updated the persistent schedule task variable name so it can be identified easier as a variable that was created by a component of the ADF.
  2. To access the task information stored within the ' application.ADFscheduler' variable from within your Apps and/or Site code it is a best practice to call the following Scheduler LIB method: application.ADF.scheduler.getSchedulerVars();

NOTE: Using the getSchedulerVars() method call from within Apps and Site Code will insure that your code remains compatible even if this variable changes again in the future. Also In the future this scheduler variable may be move to be included in a common variable scope location along with other application level ADF variables that are stored outside of the standard 'application.ADF' scope.

  • It is recommended that you update any App code that uses the Scheduler to reflect these changes before the ADF 1.5 truck code is updated with these updates.
  • When the ADF 1.5 trunk is updated to include these changes it is also recommended that you update any Customers that use the Scheduler components in Apps or in Site code to reflect these updates.

Usage

The scheduler can be used to call URLS directly or can run commands using ADF.utils.runCommand style arguments.

To schedule a process call the scheduleProcess command with the following arguments:

  • scheduleName - Required - which we use later, if you use a duplicate name the existing schedule gets overriden and stops wherever it was running.
  • commands - Required - Array of URL's or array of structures
    • If using structures the layout looks like so:
scheduleItem = StructNew();
scheduleItem.bean = "csContent";
scheduleItem.method = "populateContent";
scheduleItem.args.elementName = "My Test Element";
scheduleItem.args.data.fieldName = "fieldValue";
  • scheduleParams - Optional - Structure of parameters to override.
scheduleParams = StructNew();//Default Values
scheduleParams.delay = 5; //minutes till next schedule item
scheduleParams.tasksPerBatch = 1; //how many tasks to do per iteration
scheduleParams.scheduleStart = 1; //Where in the command list to start processing
scheduleParams.scheduleStop = ArrayLen(commands); //When to stop processing (say stop at position 11)
  • startProcessNow - Optional - By default the process will run its first step immediately in the current request, for faster response time to the scheduler simply change this value to false.

Now that you have the parameters that you need to know, see an example of a schedule to call http://www.google.com 4 times. You would typically have this hit a URL that does some sort of processing.

commands = ArrayNew(1);
commands[1] = "http://www.google.com";
commands[2] = "http://www.google.com";
commands[3] = "http://www.google.com";
commands[4] = "http://www.google.com";
application.ADF.scheduler.scheduleProcess("Call Google",commands);

We can also have it call a custom function:

commands = ArrayNew(1);
commands[1] = StructNew();
commands[1].bean = "myCustomBean";
commands[1].method = "myCustomMethod";
commands[1].args = StructNew();
commands[1].args.argName1 = "argValue1";
commands[2] = StructNew();
commands[2].bean = "myCustomBean";
commands[2].method = "myCustomMethod";
commands[2].args = StructNew();
commands[2].args.argName1 = "argValue1";
application.ADF.scheduler.scheduleProcess("Call Custom Command",commands);

Now that is all fine and dandy, however, how do you get a response that allows you to monitor the process? Simply add this to your output:

#application.ADF.scheduler.getScheduleHTML("Call Google")#

It will render a progress bar and give you the ability to pause/resume the process.

Description

Properties

Functions