lucee.Componentcoldbox.system.async.tasks.ScheduledTask
coldbox.system.web.tasks.ColdBoxScheduledTask
This object represents a scheduled task that will be sent in to a scheduled executor for scheduling. It has a fluent and human dsl for setting it up and restricting is scheduling and frequency of scheduling. A task can be represented as either a closure or a cfc with a `run()` or custom runnable method.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
cacheName
The cache name to use for server fixation and more.
|
true
|
false
|
|
any
|
cachebox
|
true
|
false
|
|
any
|
controller
--------------------------------------------------------------------------.
|
true
|
false
|
|
array
|
environments
Execution Environment.
|
true
|
false
|
|
any
|
log
|
true
|
false
|
|
boolean
|
serverFixation
This indicates that the task should ONLY run on one server and not on all servers clustered for the application.
|
true
|
false
|
|
numeric
|
serverLockTimeout
How long does the server fixation lock remain for.
|
true
|
false
|
|
any
|
wirebox
|
true
|
false
|
Constructor Summary | |
---|---|
init(any name, any executor, [any task=''], [any method='run'])
Constructor. |
Method Summary | |
---|---|
boolean
|
canRunOnThisServer()
Verifies if a task can run on the executed server by using our distributed cache lock strategy. |
any
|
cleanupTaskRun()
This method is called ALWAYS after a task runs, wether in failure or success but used internally for. |
coldbox.system.web.tasks.ScheduledTask
|
err(any var)
Send errors to LogBox. |
any
|
getCache()
This method retrieves the selected CacheBox provider that will be used for server fixation and much more. |
string
|
getCacheName()
|
string
|
getCachebox()
|
string
|
getController()
|
string
|
getEnvironments()
|
string
|
getFixationCacheKey()
Get the server fixation cache key according to name and scheduler (if any). |
string
|
getLog()
|
string
|
getServerFixation()
|
string
|
getServerLockTimeout()
|
string
|
getWirebox()
|
boolean
|
isConstrained()
This method verifies if the running task is constrained to run on specific valid constraints:. |
ColdBoxScheduledTask
|
onEnvironment(any environment)
Set the environments that this task can run under ONLY. |
ColdBoxScheduledTask
|
onOneServer()
This indicates that the task should ONLY run on one server and not on all servers clustered for the application. |
coldbox.system.web.tasks.ScheduledTask
|
out(any var)
Send info messages to LogBox. |
any
|
setCacheName(any cacheName)
|
any
|
setCachebox(any cachebox)
|
any
|
setController(any controller)
|
any
|
setEnvironments(array environments)
|
any
|
setLog(any log)
|
any
|
setServerFixation(boolean serverFixation)
|
any
|
setServerLockTimeout(numeric serverLockTimeout)
|
any
|
setWirebox(any wirebox)
|
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
name
- The name of this taskexecutor
- The executor this task will run under and be linked totask
- The closure or cfc that represents the task (optional)method
- The method on the cfc to call, defaults to "run" (optional)Property Detail |
---|
The cache name to use for server fixation and more. By default we use the template
region
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- cacheboxserializable
- true-------------------------------------------------------------------------- DI --------------------------------------------------------------------------
access
- publicrequired
- falsereturntype
- anyinject
- coldboxserializable
- trueExecution Environment
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- logbox:logger:{this}serializable
- trueThis indicates that the task should ONLY run on one server and not on all servers clustered for the application.
Please note that this will ONLY work if you are using a distributed cache in your application via CacheBox.
The default cache region we will use is the template
cache, which you can connect to any distributed
caching engine like: Redis, Couchbase, Mongo, Elastic, DB etc.
access
- publicrequired
- falsereturntype
- anyserializable
- trueHow long does the server fixation lock remain for. Deafult is 60 minutes.
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- wireboxserializable
- trueMethod Detail |
---|
Verifies if a task can run on the executed server by using our distributed cache lock strategy
This method is called ALWAYS after a task runs, wether in failure or success but used internally for any type of cleanups
cleanupTaskRun
in class
ScheduledTask
Send errors to LogBox
err
in class
ScheduledTask
var
- Variable/Message to sendThis method retrieves the selected CacheBox provider that will be used for server fixation and much more.
Get the server fixation cache key according to name and scheduler (if any)
This method verifies if the running task is constrained to run on specific valid constraints: - when - dayOfTheMonth - dayOfTheWeek - lastBusinessDay - weekends - weekdays - environments - server fixation This method is called by the `run()` method at runtime to determine if the task can be ran at that point in time
isConstrained
in class
ScheduledTask
Set the environments that this task can run under ONLY
environment
- A string, a list, or an array of environmentsThis indicates that the task should ONLY run on one server and not on all servers clustered for the application.
Please note that this will ONLY work if you are using a distributed cache in your application via CacheBox.
The default cache region we will use is the template
cache, which you can connect to any distributed
caching engine like: Redis, Couchbase, Mongo, Elastic, DB etc.
Send info messages to LogBox
out
in class
ScheduledTask
var
- Variable/Message to sendcacheName
cachebox
controller
environments
log
serverFixation
serverLockTimeout
wirebox