2015-07-13 06:23:07 -04:00
|
|
|
[[condition]]
|
|
|
|
=== Condition
|
|
|
|
|
|
|
|
When a watch is triggered, its condition determines whether or not to execute its actions.
|
|
|
|
Watcher supports four condition types: <<condition-always, `always`>>, <<condition-never, `never`>>,
|
|
|
|
<<condition-script, `script`>> and <<condition-compare, `compare`>>.
|
|
|
|
|
|
|
|
NOTE: If you omit the condition definition from a watch, the condition defaults to `always`.
|
|
|
|
|
|
|
|
When a condition is evaluated, it has full access to the watch execution context, including the watch payload (`ctx.payload.*`).
|
2015-09-02 22:30:16 -04:00
|
|
|
The <<condition-script, script>>, <<condition-compare, compare>> and <<condition-array-compare, array-compare>>
|
|
|
|
conditions can use the data in the payload to determine whether or not the necessary conditions have been met.
|
2015-07-13 06:23:07 -04:00
|
|
|
|
|
|
|
include::condition/always.asciidoc[]
|
|
|
|
|
|
|
|
include::condition/never.asciidoc[]
|
|
|
|
|
|
|
|
include::condition/script.asciidoc[]
|
|
|
|
|
|
|
|
include::condition/compare.asciidoc[]
|
2015-09-02 22:30:16 -04:00
|
|
|
|
|
|
|
include::condition/array-compare.asciidoc[]
|