Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Business logic and actions in a ThingWorx application are driven by events. Events are interesting or critical property states that a Thing publishes to subscribers. Events are defined at the thing, thing template, or thing shape level, and can be as simple as a new data value from a device, to complex events from many data points. An event that is created on a thing shape or thing template level is inherited down into the entities that implement the shape or template that defines the event.
Types of Events
Built-in Events
Every entity in ThingWorx can use several built-in events. These events are automatically triggered when a prerequisite condition is met. In some cases, you must provide information that determines the specifics of that prerequisite.
Common built-in events include:
In ThingWorx, there are standard events and related data packets (defined by Data Shapes). The most common type of event is a Data Change related to a Thing property. The Data Change fires when a property value changes. The specifics of this event can be configured from the Data Change Info section of the Property Creation page. When you define a property, there are many configuration aspects.
Example:
Using DataChangeEvent, you have a few options for setting an event to fire when there is new data for a property:
The Alert event is also attached to a property and is set up from the Property Definition page. An Alert event fires when the value of the property reaches a certain threshold or value. Depending on the base type, you may specify the condition of this event from the Manage Alerts button.
Timer events can be used to run jobs or fire events on a regular basis. Things themselves can fire specific events such as Thing Start or “special” things, like a Timer type thing that contains special event(s).
How to Set up and Configure Timers
Creating a Custom Event
To create a new custom event:
Once created, the event appears on the Subscriptions page for subscribing. Since the event is custom built, you must specify when it triggers. This is often accomplished from within a service.
Best Practices
Event Processing Subsystem
The Event Processing Subsystem manages event processing for external subscriptions (Things subscribing to other Things) throughout ThingWorx.
Event Queue Processing Settings |
Base Type |
Default |
Notes |
Min Threads Allocated to Event Processing Pool |
NUMBER |
16 |
|
Max Threads Allocated to Event Processing Pool |
NUMBER |
500 |
|
Max Queue Entries Before Adding New Working Thread |
NUMBER |
200000 |
Maximum number of entries to queue before adding a thread to the pool |
Additional Information
PTC ThingWorx Help Center - Thing Events
Creating and Triggering Custom Events in ThingWorx
(scheduler)scheduled event in thingworx 9.3, given example.