Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello all,
I'm implementing alarm handling mechanism which should closely resemble that of alerts (Alert History). However, I stumbled upon a problem associated with a stream. Say I have an array of certain entries which I have to put into a stream. If I loop through that list and run "AddStreamEntry" service with each iteration, in the end I'll see only a single (last) entry. I found an explanation to this in ThingWorx documentation - if a new record has the same timestamp as that of the previous (within 1ms) , the previous entry will be overwritten.
The timestamp is a key field for streams. If you add an entry with the same timestamp, it will overwrite the previous timestamp (upsert). To avoid overwriting, specify milliseconds for the timestamp. |
Does it mean that if two alerts will get acknowledged within 1 ms only 1 record will be made in AlertHistory stream?
Solved! Go to Solution.
You are correct. If you have two alerts that triggered at the exact same instant (down to the same millisecond), you will only ever have one entry appearing in the stream. The entry added last will always overwrite the contents of the earlier entry.
You are correct. If you have two alerts that triggered at the exact same instant (down to the same millisecond), you will only ever have one entry appearing in the stream. The entry added last will always overwrite the contents of the earlier entry.