[英]Can a single Windows Workflow instance be configured to use multiple databases?
We are using Windows Workflow engine for our .NET 4.5 based ASP.Net application. 我们将Windows Workflow引擎用于基于.NET 4.5的ASP.Net应用程序。 The Windows Workflow application is deployed as an IIS application and is configured for SQL persistence with the connection information specified in the web.config file. Windows Workflow应用程序被部署为IIS应用程序,并使用web.config文件中指定的连接信息进行了SQL持久性配置。 We now want to move this application (along with the Workflow engine) to the cloud. 现在,我们希望将此应用程序(以及工作流引擎)移至云中。
Regarding this cloud migration, we are somewhat confident about the following decisions that we made for our ASP.Net (non Windows Workflow) application: 关于此云迁移,我们对为ASP.Net(非Windows Workflow)应用程序做出的以下决定有些信心:
However, we are not very sure on how to migrate the Windows Workflow application to the cloud. 但是,我们不确定如何将Windows Workflow应用程序迁移到云中。 As I understand, we have the following choices: 据我了解,我们有以下选择:
With #1, we are primarily concerned about the performance as the load increases on this single database. 在#1中,我们主要关注性能,因为此单个数据库上的负载增加。 With #2, the concern is web application scalability since it does not seem right to have 1000 web applications for 1000 customers. 对于#2,关注的是Web应用程序的可伸缩性,因为为1000个客户提供1000个Web应用程序似乎并不正确。
That leaves us with option #3, which we think is the right way to go. 这给我们留下了选择#3,我们认为这是正确的选择。 However, we are not sure if this can be done in Windows Workflow or not. 但是,我们不确定是否可以在Windows Workflow中完成此操作。
So the question is, can a single instance of Windows Workflow web application be somehow configured or programmed to talk to multiple SQL persistence databases? 因此,问题是,是否可以以某种方式对Windows Workflow Web应用程序的单个实例进行配置或编程,使其与多个SQL持久性数据库对话? If yes, how can we achieve that? 如果是,我们如何实现?
Thanks! 谢谢!
I never do it myself, but I think that you can do this by implementing your own PersistenceService
. 我从来没有自己做过,但是我认为您可以通过实现自己的PersistenceService
来实现。 To do this, derive from WorkflowPersistenceService
abstract class, which has a methods like SaveWorkflowInstanceState
/ LoadWorkflowInstanceState
. 为此,请从WorkflowPersistenceService
抽象类派生,该抽象类具有诸如SaveWorkflowInstanceState
/ LoadWorkflowInstanceState
类的方法。
In this methods you can access WorkflowInstanceId
property of workflow. 在这种方法中,您可以访问WorkflowInstanceId
属性。 I think that you can use this property to decide where to store this specific workflow instance. 我认为您可以使用此属性来确定将特定工作流实例存储在何处。 To be able to load (restore) workflow from proper database you will need to implement some mapping like this: WorkflowInstanceId
: DatabaseId
. 为了能够从适当的数据库加载(还原)工作流,您将需要实现一些映射,如下所示: WorkflowInstanceId
: DatabaseId
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.