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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to monitor bound property quality in TWX and trigger other services

LeoChen
7-Bedrock

How to monitor bound property quality in TWX and trigger other services

Dears,
I have amount of bound tags(greater than 1000) needed to monitor. When any quality turns to bad or other status except good, subscription should be triggered to send info. How can I config event or subscription to get this with minimal impact on system stability.
Thanks.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @LeoChen ,

 

Your subscription code requires a fix, because you're verifying the value at the end, and you should look at the quality.

The first part will also always evaluate to true and even if you compare the oldValue to newValue, it's still simpler to just look at the quality:

if (eventData.newValue.quality!="GOOD")

View solution in original post

9 REPLIES 9
Arun_C
16-Pearl
(To:LeoChen)

Hi @LeoChen,

 

Kindly refer the attached link. I hope it may be helpful in your query.

Monitor Quality of Tags:https://community.ptc.com/t5/ThingWorx-Developers/How-to-monitor-the-quality-of-the-bound-tag/td-p/710794

 

Thanks & Regards,

Arun C

 

LeoChen
7-Bedrock
(To:Arun_C)

Thank you. But I need to know how to minimal impact on system. Because the count of property is to much,

Now I creat subscription with the event of AntDataChange,which is not very well.

Regards.

slangley
23-Emerald II
(To:LeoChen)

Hi @LeoChen.

 

Are there some tags that are more important to monitor?  Instead of monitoring all 1000 tags, you could monitor for the isConnected property or you could monitor to validate that updates are occurring.  Generally if you begin to see problems with the quality, there is a greater underlying problem and should not be necessary to monitor all tags to determine this.

 

You could also create a dashboard to provide a visual of what's happening in your network.

 

Regards.

 

--Sharon

 

 

Hello,

 

I can only think of the AnyDataChange, too.

 

What exactly is the issue with this approach? Does it slow your system down? If yes, you can share the body of this subscription, maybe we'll be able to give some advice on optimizing it.

 

/ Constantine

I'm aligned with Constantine here. You do need to verify each property value incoming in ThingWorx to see which is Quality BAD. In a subscription it will be very fast to check via an "if" the quality. I doubt it will be faster at this level if you do it in a Java extension, so I'm also curious to see what exactly are performance concerns and the subscription code.

subscription is very simple.

 20230721-133902.jpg

Hi @LeoChen ,

 

Your subscription code requires a fix, because you're verifying the value at the end, and you should look at the quality.

The first part will also always evaluate to true and even if you compare the oldValue to newValue, it's still simpler to just look at the quality:

if (eventData.newValue.quality!="GOOD")

OK. Thank you.

Vladimir's answer should be enough for this to scale.

 

Just to add, if you need to use "and" logic, you should use && instead of &, otherwise it will always evaluate both sides.

 

Also, it's better to use !== instead of != to avoid JavaScript type coercion, although I don't think it will make it more performant.

 

Finally, if you still experience performance issues after applying Vladimir's suggestion, check that those subscriptions are triggered on behalf of an admin user -- this would disable permission checks, making such frequent simple service calls even faster.

 

/ Constantine

Top Tags