Azure Notification Hub: How to handle registration for a million devices?

南楼画角 提交于 2019-12-12 03:53:47

问题


Requirement-

The requirement is to send notifications to devices on specific times. That is, if a user has setup a schedule at 07:00 AM for breakfast, he'll get a notification for the same like 'Its time for breakfast, blah blah blah!'.

However, if the user has already had his breakfast before 07:00 AM, he'll make his diary entry on what he had etc. and then the notification must not be sent to him.

This is a recurring schedule and the user will only change this if he needs to, otherwise, the schedule will mostly be the same.

What we have achieved?-

So, for now what we do is to register devices with tags like '{TimeZone:EST},{Breakfast:07:00:00}' on the app's launch.

In case, the user has already had his breakfast, we update his registration on notification hub to also contain a tag like '{HadBreakfast}' - So, the set of tags user's device is registered to becomes - '{TimeZone:EST},{Breakfast:07:00:00},{HadBreakfast}'

What are we stuck at?-

This approach will work very well because, when sending notifications, we use tag expression like - '{TimeZone:EST} && {Breakfast:07:00:00} && !{HadBreakfast}'

So, this will send a notification to all users that wants a notification for breakfast at 07:00:00 AM for EST timezone but not to the ones who already had their breakfast.

However, if the user is registered with a tag like {HadBreakfast}, then the next day, he might not get the notification based on the logic just described.

So, we came up with the workaround to de-register only the {HadBreakfast} tag at the end of day for all the devices which has that tag by running a scheduler.

But, somewhere in our mind, we think that is not the best solution for this problem.

Other Alternative-

We also thought of another alternative that we can run a scheduler for every hour within which, it will do the same thing of removing such tags for the past hour for all the user devices which has that tag - and this process seems to be effective than running it once in a day.

But we wanted to know thoughts from the community on what I can try out? If the method that we use is correct or not? What else could be done to do this more simply OR smoothly? What if we have a million plus devices? Will this work?


回答1:


I would suggest exploring the option for modifying registration in bulk and using the Azure Scheduler for the reaccuring task



来源:https://stackoverflow.com/questions/34395270/azure-notification-hub-how-to-handle-registration-for-a-million-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!