- Timers and Schedulers can be used to run jobs or fire events on a regular basis. Both are implemented as Thing Templates in ThingWorx. New Timer and Scheduler Things can be created based on these Templates to introduce time based actions.
- Timers can be used to fire events in a certain interval, defined in the Timer’s Update Rate (default is 60000 milliseconds = 1 minute).
- Schedulers can be used to run jobs based on a cron pattern (such as once a day or once an hour). Schedulers will also allow for a more detailed time based setup, e.g. based on seconds, hours, days of week or days months etc.
- Events fired by both Timers and Schedulers can be subscribed to with Subscriptions which can be utilized to execute custom service scripts.
- Timers and Schedulers are handled via the Event Processing Subsystem. Metrics that impact current performance can be seen in Monitoring > Subsystems > Event Processing
- Implementing Timers and Schedulers on a Thing Template level might flood the system with services executions originating from Subscriptions to Timer / Scheduler triggered Events.
- Subscribing to another Thing’s Events will be handled via the Event Processing Subsystem.
- Subscribing to an Event on the same Thing will not be handled via the Event Processing Subsystem, but rather execute on the already open in memory Thing.
- If Timers and Schedulers are not necessarily needed, the Services can be triggered e.g. via Data Change Events, UI Interactions etc.
- Recursion can be a hidden performance contributer where a Subscription to a certain Event executes a service, triggering another Event with recursive dependencies. Ensure there are no circular dependencies and service calls across Entities.
- If possible, reads for each and every action from disk should be avoided. Performance can be increased by storing relevant information in memory and using Streams or Datatables or for persistence.
- If possible, call other Services from within the Subscription instead of handling all code within the Subscription itself.
Discover more from My Tricky Notes
Subscribe to get the latest posts sent to your email.