Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello Comunnity :),
I'm thinking how to manage some alerts in TWX and for this I need a subscription. If I've created a subscription in order to send one emain when a alert trigger, if I create the subcription in a thing template, this subscription is gonna be repeated in each thing? So if I have 10 things with this subscrition(any alert) I will have 10 subscription checking the conditions for send one email, for example?
So this can be inefficient, It's better to have this subscrition in a external thing?
Thank you
Luis.
Solved! Go to Solution.
Incorrect. Each subscription will run only in the context of that specific Thing. It runs anytime that Thing's event is triggered (no relationship with other Things events by default).
In short, no, an alert will send only one email.
Out 10 things only if few things having an alerts, you can create subscription at thing level.
If you create a subscription in the template, then all inherited Things from that template will run the subscription code.
If you have 10 things they will all run in parallel the subscription code because the assumption is you want that alert to be triggered based on that Thing specific conditions (meaning in that Thing context). This is one of the core ways in which ThingWorx works and it scales very well.
That also means you'll get one email per Thing. If you want to have a single email for all the Things, then there is another approach that needs to be taken, but generally speaking I have not seen this yet.
Can you share more details about what you're trying to accomplish ? Also, have you had a change to go through the ThingWorx training yet? Lots of concept like this are explained there.
Note: depending on the code you write in the subscription you might not have a very scalable experience (eg: if you have tens of things and in the subscription you query the database etc...), but I doubt this is the situation in your case.
Hello @VladimirRosuand @Sathishkumar_C ,
Thank a lot for your reply :). Yes, I've done the formation actually the doubt it's only to confirm. I've create a draft for try to explain better. The main use case it's that I want to send any alert by email. So If the subscription is the thing template and I have 5 things, one alert it's trigger by one thing I will send 5 emails no ? because the subscrition is the same in all the things and acts like the following image.
So maybe for this functionallity it's better to have one external thing with this subscrition because if not I will have the problem that all the subscritions
trigger...
Am I rigth?
Thank You
Incorrect. Each subscription will run only in the context of that specific Thing. It runs anytime that Thing's event is triggered (no relationship with other Things events by default).
In short, no, an alert will send only one email.
Thank you @VladimirRosu.
So the AnyAlert event input in the subscription is in the thing context not in the all the entities context...
Thanks a lot.