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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Issues with alert acknowledgement and alert history

Michail
9-Granite

Issues with alert acknowledgement and alert history

Hello all, earlier I asked a question about Alert History and it was confirmed that if I want to acknowledge multiple alerts (>10) on a "thing" entity, "AlertHistory" stream would not be able to capture that Choosing the most appropriate data storage method​. Can anyone suggest a way around this problem? The only solution I can come up with is to use a data table instead. However, the question arises how to generate a unique key for each entry from each "thing" (concurrency problem). Thank you for your suggestions!

3 REPLIES 3
ankigupta
5-Regular Member
(To:Michail)

mnudel​,

I am not sure if I understand your query completely. But did you try to add a delay in acknowledging the alert?

Ankit Gupta​​, to put it simply, if I run a for-loop on a "thing" to acknowledge several alerts, only one or two will be written to "AlarmsHistory" stream. The reason being is that the for-loop will complete its cycle in less than 1 ms, meaning that all alerts processed by the for-loop will share the same timestamp. In turn, this will overwrite records in the "AlertHistory" stream. Can you suggest a way a safe way of introducing 1 ms delay? There is also a chance that another alert maybe acknowledged on another "thing" during same millisecond. Thanks.

You may ask why would you like to do that?! In our application machine alarms are mapped to alerts. No intervention from the users' point of view is required, just visibility. So, if a number of Boolean properties become 'true', corresponding alerts are raised. On 'false' condition, alerts are automatically acknowledged. The reason behind such approach was to utilise various ThingWorx alert services.

Michail
9-Granite
(To:Michail)

Having exhausted all my options available, I've decided to use the pause() function as suggested by Carles Coll​ in Re: Asyncronous Streams and Delayed Calculations Execution?

pause(1); //wait 1 ms

//acknowledge alert

This way entries in "AlertHistory" stream are populated correctly with a different timestamp. Not sure though how it will affect the performance. There not as many machines as described in the above post and alerts should be a rare occasion.

Top Tags