Events
- Timers and Schedulers both come with a specific Event inherited from the Thing Template:
- Timer
- ScheduledEvent
- Both have a Data Shape allowing to capture the timestamp of when the Event was actually fired.
- Events in ThingWorx are triggered when a specific condition is met. In this context the condition is met and the Event is fired when a Timer has expired or a Scheduler's time is reached.
- Once an Event is triggered, Subscriptions will take care of executing custom Services to react to the Event.
Subscriptions
- Subscriptions listen to Events and can be used to react to certain Events with running custom Service scripts.
- To follow-up on Timers and Schedulers, a new Subscription must be created, listening to any related Event fired.
- Add a new Subscription to the Thing with
- As the Subscription is usually listening to the Thing that it is configured on, the Source has to be left empty. When listening to other Entities' Subscriptions the corresponding Entity can be picked in the Source Entity picker.
- Ensure to check the Enabled checkbox to actually enable the Subscription and allow it for executing code in the Script area.
- The following Script will log into the ScriptLog once the Timer Event is fired
- The following Script will log into the ScriptLog once the ScheduledEvent Event is fired
Comments
‎Nov 20, 2019
03:36 AM
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Notify Moderator
‎Nov 20, 2019
03:36 AM
What should be Input/Output in a subscription?