Skip to main content
1-Visitor
July 1, 2022
Solved

Subscription event firing twice simultaneously

  • July 1, 2022
  • 1 reply
  • 1319 views

I am implementing some TOFF logic in my application.

I have a  Thing with a subscription listening to some state tags in an opc server. I have to calculate the final state based on this. S

ometimes two states change simultaneously firing the event twice at the same time which i do not want because it executes the change state logic twice  in parallel in different processors obtaining the same result twice and firing the subscripiton listening if the state has changed to fire twice simultaneously despite in practice having only one change.

Is it possible to force  the subscription to only execute in a single processor so that the second firing is after the first instead of simlutaneous?

Best answer by AViñeta

For anyone interested i found a satisfying answer in this post: https://community.ptc.com/t5/IoT-Tech-Tips/Thread-Safe-Coding-in-ThingWorx-Part-1-The-Java-Extension/td-p/700958

1 reply

AViñeta1-VisitorAuthorAnswer
1-Visitor
July 5, 2022