Skip to main content
14-Alexandrite
March 28, 2024
Solved

Multi Event subscription

  • March 28, 2024
  • 1 reply
  • 2378 views

Hello all,

 

I have a thing template that implement a remote thing (csdk).

From the csdk i trigger an event. Then i subscribe to this event thingworx side.

In my case, i can have multiple remote things triggering this event simultaneously, and I want to subscribe to these events from another thing. I cannot find a way to do it.

 

Exemple

1 - Thing Template TT implementing the remote thing.

2- thing1, thing2,thing3,thing4 implementing TT and trigger 'event '

3- ThingX need to subscribe to the 'event' triggering simultaneously from thing1, thing2,thing3,thing4

 

Do you have an idea what is the best why to do it ?

 

Thank you

Best answer by Rocko

I agree with Velkumar, if the rooms store the people count, the HomeThing shouldn't duplicate the data, but just aggregate it, when it is needed.

On the other hand, if you're not interested in the individual room count but just on the total count, then yes, you could subscribe HomeThing to all rooms events and update the global counter.

From your first post my understanding is you have trouble subscribing to the events of another thing.

When you create the subscription, there is a field called Source. There you have to select "Other entity" and select the entity you want to subscribe to. See here

If your question is how to do this programmatically, you can only use Dynamic Subscriptions, but they are not permanent (you can find about this in the community e.g. here)

Also, Thingworx 9.5 brings multi-event subscriptions, where one subscription can listen to multiple events. I am not aware if this can also be set up using API.

1 reply

19-Tanzanite
March 29, 2024

Hi @AliBenBelgacem 

 

You can create a subscription in Thing Template TT and call the ThingX service inside the subscription. So whenever thing1, thing2, ... thingN event triggered, service from ThingX will be triggered.

 

/VR

14-Alexandrite
March 29, 2024

Hi,

Thank you for your proposition but this what i already did.

I want to do it the opposite way. in my project the thingX contain thing1, thing2, thing3, thing4.. 

You can see the attached picture to understand better. I want that Home see and pilot room. the room work autonomously, no depending on anything. So in Room thing I should put no reference to Home.

 

19-Tanzanite
March 29, 2024

Hi @AliBenBelgacem 

 

Could you please explain your use case.

 

Based on the diagram, you can locally bind property from ThingX to Thing1... ThingN in template level.

Velkumar_0-1711702654116.png

So when property gets changed in ThingX it also updates property in other Things. Based on that you can trigger your subscription.

 

/VR