使用时间表和活动开始背景服务
我有一个背景工人来听消息的服务总线(Azure Service Bus)。
每条消息代表该服务应执行的异步任务,但是对于没有事件到达总线的情况,我也希望每天自动触发服务。
服务总线当前是由用户事件触发的,这些用户事件在不同的API中生成。
这很好,但是谁应该以一定的时间表触发我的服务?
我当然可以编写第二份服务,每周将消息发送到总线,但是只能为此任务运行服务,感觉有点过分。
我想知道是否有更好的解决方案我该怎么做?即使是Azure功能,对我来说似乎过高了...
您将如何解决这个问题?
I have a background worker that listens to a service bus (Azure Service bus) for messages.
Each message stands for an async task that the service should work on, but for the case that no event is reaching the bus, I also want to trigger the service automatically each day.
The service bus is currently triggered by user events that are generated in different APIs.
This works fine, but who should trigger my service with a certain schedule?
I could of course write a second service that sends a message to the bus each week, but it feels kind of overkill to have a service running only for this task.
I am wondering if there is a better solution how I could do this? Even an Azure Function seems overkill for me...
How would you address this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
azure函数是理想,因为您可以同时触发计时器 在相同功能应用程序中触发的服务总线触发功能。
如果您觉得它过多,我建议另一种选择是使用可以在应用程序服务中运行的 Azure Web作业。
您可以使用计时器触发的Web作业,并使用该Web作业SDK在Azure Service Bus中有消息时触发它们。
请参阅服务总线触发WebJobs 有关更多信息。
Azure Functions are ideal because you can create both a timer triggered, and service bus triggered function in the same Function App.
If you feel it is excessive, I suggest the other option is to use the Azure Web jobs which can run in the App Services.
You can have timer-triggered Web jobs and use that Web job SDK to trigger them whenever there is a message in the Azure Service Bus.
Refer to the Scheduled Webjobs and Service Bus triggered webjobs for more information.