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

ThingTemplate subscription not executing in derived things

John_H
Regular Member

ThingTemplate subscription not executing in derived things

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.

4 REPLIES 4

Re: ThingTemplate subscription not executing in derived things

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?

Re: ThingTemplate subscription not executing in derived things

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"}); 

Re: ThingTemplate subscription not executing in derived things

Hi,

I am using almost the same model that you are using and this is working for me. The only difference is that I am using thingworx 8.4.5.

I however have few pointers that you might want to double check - 

1) Try to make changes in the properties Data change aspects, under Advanced Settings and set it to always

2) Try to check the logs if you can find any pointer related to your implementation.

Thanks

Aditya

Re: ThingTemplate subscription not executing in derived things

Thanks for the replies.

 

We are planning some significant changes to our model, also involving moving subscriptions between templates, so I have been experimenting with these changes on a test set of Thing Templates and Things, which has allowed me to reproduce this issue. And after some more experimentation, I discovered that I can reproduce this problem by repeatedly removing and re-adding the same subscription in a Thing Template until it appears.

 

Now that I have recreated the issue, I do not see any related error entries in the Application or Script logs.

 

The suggestion to use Resources["EntityServices"].RestartDependenciesForThingTemplate({name : "ThingTemplate Name"}); did not fix the issue. I extended it to also include restarting each implementing Thing, which did not work.

 

The other suggestion to modify the Data Change Type for the properties did not appear to have an effect.

 

What I did do was have the Thingworx service rebooted while the issue was present. In this instance, the subscriptions behaved as expected after the reboot.

 

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.