运行 Azure 上基于用户特定计划时间的计划程序

Run scheduler on Azure based on user specific scheduled time

我们有一个API根据预定Next_Refresh_Time获取用户的最新交易数据。每个用户都有不同的预定刷新时间。由于我们有成千上万的用户,我们必须 运行 调度程序来获取数据。请建议我最好的方法。

Each user has different scheduled refresh time. Since we have thousands of users we have to run the scheduler to fetch the data.

您可以添加队列消息并指定initialVisibilityDelay with Next_Refresh_Time value when a user login, and then you could create and run a Queue-trigger WebJob处理队列消息并获取最新数据(如果当前用户仍然在线,则添加消息(指定与原始消息相同的内容和initialVisibilityDelay)到队列)。

此外,如果您想将最新数据实时推送给特定连接的用户,SignalR 可以帮助您实现实时功能,SignalR 可用于多种client platforms。可以在queue message中保存登录用户的connection id,然后调用WebJob函数中的hub方法,根据connection id向已连接的用户推送数据。

以下线程和文章将有助于了解如何建立连接和调用集线器方法。