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
Hi,
I was wondering what peoples thoughts might be as the best way to achieve some data storage in my project.
I am trying to create a table to store how a customer wants the server to respond to certain events (i.e. via sms, email, no response etc.). Our remote assets produce a number of events types (c.30 different types) which are subscribed to on the platform. These are events things like 'Fault condition' 'User Login' 'Temperature too high'.
I am trying to create a mash up which will allow a customer to configure which events they wish to be notified about. So, my question is what would be the best way of storing their notification configuration? Assuming I have a datashape to describe the response for each event type, something like
What would be the best method to store the user defined configuration. Bearing in mind that there will be hundreds of customers, and that we might/will add more event types, which of the following should I use?
Thanks in advance.
I would probably go with either the InfoTable property of a Customer Thing or the DataTable.
A little more robust in a DataTable but response will be a bit slower.
Hi Pai,
thanks for the input. I have actually started down that road, but I was a little worried about using persistent infotables as I thought I'd read somewhere that it wasn't recommended to use infotables as properties of things?
Since InfoTables properties reside in the JVM it increases memory usage. However in your use case it doesn't sound like a lot of data.
I'm assuming customers are actual TWX users (have a username and pw). If so, you can simply add your infotable property to the UserExtensions Thing Shape and not have to worry about a custom customer thing. But every time you have an event occur, you would need to loop through all your users to get their subscribed events and method of notification.
I think it will be faster to store everything in a DT, and then for each event, query the DT for that event ID to get just the users subscribed to that event, along with their notification preference. This quickly gives you a single IT to deal with that you can loop over and fire notifications based on the boolean preference selection rather than having to loop over every user, check if they're subscribed to the event and then do something.
Thing properties are sit in JVM so obivously it would raise performance isssues if the user count increases. so keeping infotable has a property is not advisable. If there is a way to categorize the user types then you can create streams for each category and keep the notification configuration information. Compare to datatable, stream will be having faster reponse since it is optomised and comes with default timestamp filters.