Skip to main content
1-Visitor
December 9, 2019
Question

ThingTemplate subscription not executing in derived things

  • December 9, 2019
  • 1 reply
  • 2251 views

ThingworxModelOutline.png

 

 

Above is a general outline of our Thingworx Model we are working towards using Thingworx 8.5.0-b12 with Kepware's KepServer. We start with a base ThingTemplate, then have a set of Thing Templates inherit the BaseTemplate based on the manufacturer or model of the real world device we are modeling. From there, we create a Thing for the real-world device and it inherits from the appropriate model template. We then bind the properties of our Things to the properties of Industrial Things that are made available through our Kepware Industrial Connection.

The problem comes when I added an overridable service and subscription to the BaseTemplate. The subscription calls the service on the AnyDataChange event for 'Me'. This works great except for the Things derived from a particular model's ThingTemplate.

For the Things that derive from the problem ThingTemplate, I can observe that the properties are changing through the binding to their corresponding Industrial Thing. If I add an additional subscription to the problem ThingTemplate that is subscribed to AnyDataChange and call the same service, it works.

This is a result of moving the service and subscription from the model ThingTemplates down to the BaseTemplate to remove duplicated logic.

1 reply

John_H1-VisitorAuthor
1-Visitor
December 11, 2019

For now, I have fixed this by deleting and recreating the affected ThingTemplate and derived Things. This works in the short term since we are just starting out and only have a relatively small set of Things in the system. This may not be the case in the future.

 

If this happens again, is there anything else we can attempt to fix a subset of Things with a seemingly broken subscription from a ThingTemplate?

5-Regular Member
December 18, 2019

If you encounter the error again, I would first recommend verifying whether manually testing the subscription on the Thing instance and checking the ThingWorx Application log and Error log for any possible errors. 

 

You can also restart all entities derived for a particular Thing Template using the following service.

 

Resources["EntityServices"].RestartDependenciesForThingTemplate({name : "ThingTemplate Name"});