如何为多租户Azure应用程序创建应用程序后台作业 [英] How to create a app background job for multi-tenancy Azure App

查看:99
本文介绍了如何为多租户Azure应用程序创建应用程序后台作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的Azure Saas应用程序创建一个后台任务.任务是查看Azure SQL数据库表的日期字段,并根据结果采取措施.该任务应该每天对所有SaaS租户运行一次.我使用ShardMapManager进行多租户,每个租户都有一个单独的Azure SQL数据库.我找不到有关如何设置WebJobs或Web函数以自动循环通过每个租户数据库的任何信息.是否会涉及将在不同数据库中运行的Elastic Job?问题在于它仅使用T-SQL代码.是否需要将EasticJobs和WebJobs结合使用?基本上,我该如何创建将针对所有租户数据库处理的后台作业?

I would like to create a background task for my Azure Saas application. The task is to look at the date field of an Azure SQL database table and take action based on the the result. The task should run once a day against all SaaS tenants. I have multi-tenancy with ShardMapManager with a separate Azure SQL database per tenant. I cannot find any information on how to set up WebJobs or Web functions to cycle through each of the tenant databases automatically. Would Elastic Job be involved which will run through the different databases? The problem is that it only uses T-SQL code. Would a combination of EasticJobs and WebJobs be required? Basically how can I create a background job that would be processed against all tenant databases?

推荐答案

我认为您可以尝试使用

I think you could try going with a Timer trigger for Azure Functions and just place the code that iterates through the databases and perform the required tasks inside as Azure Function.

我什至会进一步将流程分为两个不同的功能:

I would even go further to separate the process into two different functions:

  1. 遍历数据库

  1. Iterating through the databases

为每个数据库执行所需的逻辑

Perform the required logic per database

希望有帮助!

这篇关于如何为多租户Azure应用程序创建应用程序后台作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆