'Polling script step' is found in the 'Common' category of workflow nodes.
The polling script node runs a script on a defined interval. The node will exit if busby.exit
is called, or it reaches a maximum polls count, otherwise it will remain polling.
Content >>>
It is preferable to use a polling script node that calls a short running script on a regular basis, rather than run a long running script step. Using a long running script step if there are many jobs to poll can be very processor intensive and should be avoided.
The script to run on each poll.
/***
This script will run every x seconds (as defined in the polling interval configuration for this step)
This script should exit with a result code that then gets mapped to the next state in the diagram busby.exit(0)
***/
busby.exit(0);
The following script shows a simple use case of the polling script node. In this case on every poll an external busby service is called to find out if a particular object exists. If it does the job moves on to the next state, otherwise it will wait for the next poll around and try again. Note do not include a busby.exit on the case that the job should remain in the polling state.
const materialExists = busby.call("mam", "hasMaterial", {
id: root.job.externalRef
})
if (materialExists) {
busby.exit(0);
}
Detailed notes on the configuration editor can be found here
Content >>>
Previous: Manual step || Next: Script step
Index of: Workflow Nodes
Back to: Configuration Editor