Executing a Subscription in the Debugger
This topic describes how to execute a subscription in the ThingWorx Debugger by simulating event data. Executing a subscription allows you to test subscription logic without triggering real events and to inspect execution behavior during development.
Execution is performed from the Execute tab on the Subscriptions tab when subscription debugging is enabled.
Before executing a subscription in the debugger, ensure that:
• Subscription debugging is enabled
• The subscription is enabled
• If the subscription is defined on a ThingTemplate or ThingShape, an implementing Thing is selected
For information about enabling subscription debugging, see
Debugging a Subscription.
Running a Subscription with Simulated Events
Subscriptions are executed in the debugger by supplying simulated event data that matches the events the subscription listens for.
Each simulated event corresponds to an event alias defined on the subscription. An alias represents a specific event input and determines the structure of the data that must be provided.
Simulated events allow you to:
• Provide event data without triggering a real event
• Execute multiple events in a single debug session
• Reuse event data across debugging sessions
When defining simulated events, you select an alias and provide event data that conforms to the DataShape associated with that alias. Event data is entered using an Infotable editor. You can optionally provide a description for each event; descriptions are informational only and are not used during execution.
After defining one or more simulated events, you can select the events to execute and start a debug session. During execution, breakpoints are honored and variables, call stack, and logs are available for inspection.
Event data is validated only for JSON syntax. The platform does not validate the semantic correctness of the data.
Subscription Tools
When subscription debugging is enabled, a subscription tools panel is available from the Subscriptions tab. Use the Show Tools checkbox to display the panel.
The Subscription Tools panel provides tools for executing and debugging subscriptions and includes the following tabs:
• Execute—Simulates event data and starts a subscription debug session
• Reference—Compares subscriptions side by side
• Debug—Inspects breakpoints, call stack, and variables
• Logs—Displays script logs generated during execution
Execute Tab
The Execute tab allows you to simulate event data and run a subscription in a debug session.
Use this tab to:
• Define one or more simulated events by selecting an event alias defined on the subscription. Each alias represents a specific event the subscription listens for.
• Provide event data that matches the event’s DataShape.
• Execute selected events to start a debug session.
• Maintain state between executions when sequential execution is enabled.
If the subscription is not enabled, a message is displayed indicating that the subscription must be enabled before debugging can begin.
For subscriptions defined on ThingTemplates or ThingShapes, you must select an implementing Thing before execution.
Event data is validated only for JSON syntax. The platform does not validate the semantic correctness of the data. An optional raw JSON view is available for advanced scenarios, such as importing or exporting test data.
The Raw View option allows you to edit simulated event data directly as JSON instead of using the grid. This is useful for saving, reusing, or bulk‑editing complex test data that is not persisted with the subscription.
When Raw View is enabled, the event grid is hidden and a JSON editor displays the raw event payload. An Apply option converts valid JSON back into grid entries. Only JSON syntax is validated; if the data cannot be converted, the previous grid entries are retained. Raw view is unavailable during an active debug session.
Reference Tab
The Reference tab provides side-by-side comparison of subscriptions, similar to the Reference panel. This is useful when comparing subscription implementations across different Things.
Debug Tab
The Debug tab provides interactive debugging capabilities for subscriptions, including:
Subscription debugging differs from service debugging in the following ways:
• Breakpoints are shown only for the active subscription.
• The call stack typically contains a single entry, unless nested functions are used.
• Debug execution depends on valid input defined in the Execute tab.
Variables behave the same way as in service debugging.
Logs Tab
The Logs tab displays script logs generated during subscription execution. This tab behaves the same way as the Logs tab used when debugging services.
Execution Behavior and State
For subscriptions that have Execute Events Sequentially enabled, the debugger maintains execution state between runs. When a subscription is executed:
• The resulting state is displayed after execution.
• If an error occurs, error information is returned in the state output.
• Additional details may be available in the Logs tab.
You can manually edit the state data before the next execution. Only valid JSON is required; no additional validation is performed. State data is retained for the duration of the current logged‑in session.
Creating and Editing Simulated Events
When defining simulated events, you select an alias associated with the subscription. Each alias determines the structure of the event data. Event configuration includes:
• Selecting an alias (required)
• Providing event data using an Infotable editor
• Entering an optional description for reference
The data entry experience adapts based on the event type and associated DataShape. Changes are applied when you complete the dialog. Canceling the dialog discards any changes.