cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Thing Subscription

No ratings

Thing Subscription

This post is intended for novice ThingWorx users who wants to understand what the definition of Thing Subscription is and the overall purpose of using Thing Subscriptions.

 

Definition of a Thing Subscription?

A Thing subscription is a script(JavaScript) that is called each time an event occurs. Events are property states which are of end users interest (e.g. temperature) and therefore indicators to kick off some functionality in a Thing subscription when any action needed. Events can e.g. be triggered by an Alert that detects a change or an anomaly in property values. The Thing subscription is explicitly linked to an event and when the event is fired the data is being passed to the subscriber. 

 

Why Use a Thing Subscription?

Imagine your machine is running 24 hours 7 days a week with supervised human interaction. If a pump temperature exceeds accepted value it needs to be regulated by the manufacturing department. But no one in the department knows when the temperature will exceed accepted value or drop suddenly therefore, the machines is always sporadically physically supervised by humans which leads to heavy costs for the manufacture. With a Thing Subscription a notification alert email can be sent directly to the department manager who acts based on the email notification.

 

Thing Subscription must have

A Thing subscription must have defined a rule which gets executed when an event occurs. The definition of the rule may accommodate any appropriate business logic.

 

Thing Subscription example process

In this scenario Thing subscription is using a predictive analytics model to detect Data Change or any anomaly

values going through a Thing Property. So, based on historical data including failure information, a predictive analytics model begins to analyze run-time values from individual Things/properties to the analytics server. The predictive analytics model detects a pattern which detects past failures, when the analytics model predicts a failure/event based on the analyzed patterns an action is being fired via a Thing subscription. That action could be for ThingWorx to create a service ticket or send a notification email to the service department.

 

Example of a simple Thing Subscription set-up without using Analytics model to analyze data but instead a build-in ThingWorx alert

Below example of Thing Subscription will send a notification email when temperature exceeds defined values from ThingWorx alert configuration. Prerequisites; it is necessary to have a mail server extension imported into the ThingWorx Composer this enables the service department to receive the email notification when an event have occurred. The extension can be downloaded from the marketplace.

1. Create a Thing with the MailServer[i] as the Base Thing template.

 image

 

2. Create a new Thing and add Properties together with an alert that is triggered when the value exeeds user defined temerature.

image

 

3. Enable the Thing Subcriptions by

  • Select Subscription and click +Add
  • Make sure to mark the checkbox Enabled
  • Selecting your Event name and your Property name
  • In the right side of the screen you can enter your script/function that will notify ThingWorx email service to create the email notification
  • Select Done and Save

image

 

4. Enable Email notification by selecting Services

  • Provide an name
  • Select Me/Entities
  • Mark Other entity
  • Find your Thing where the MailServer is the Thing Template

image

 

5. Then find the SendMessage snippet/script and fill out the snippet with your personal information.

image

 

[i] View this blog for more information on how to install the MailServer

Version history
Last update:
‎Apr 12, 2018 10:49 AM
Updated by:
Labels (2)