ASPNET 的工作流程 4:并发和状态检查
我正在尝试对请求提交/批准/完成场景进行建模。我正在使用 WorkflowServiceHost 作为控制台应用程序中的服务托管的流程图工作流。该工作流具有对 IIS 中托管的 WCF 服务的服务引用,该第二个服务与应用程序数据库进行交互。我有一个 aspnet 前端,其中包含对托管工作流服务的服务引用,并从代理客户端调用其方法。
该工作流程使用我使用提供的脚本创建的持久性数据库。
该场景是用户发出服务请求。该请求必须由特定人员批准一次(我在一个分支中使用带有延迟的选择来提醒该人,如果没有决定到达,则另一个分支正在收到决定)。对于某些服务,请求必须经过第二次批准,可由一组批准者中的任何一个来完成。全部批准完成后,请求将转交给不同的人员来完成。
我可以正常工作,但有 3 个问题:
- 在 aspnet 主页中,我有一个请求列表,其中包含指向适当批准/完成的页面的链接,并在代理上调用方法,然后它们重定向回来,但因为它都是异步的,所以我必须手动刷新主页即可看到更改的列表。我是否坚持强制页面每 x 秒刷新一次以解决此问题,或者是否有办法使其同步/检查工作流程状态/等待返回消息?只是按下按钮而不知道操作是否成功,交互性不是很好。
- 有没有办法在池中的其他人批准请求后阻止某人批准请求?目前,当第二个人按下按钮时,没有任何反应(这很好)。在工作流持久性数据库中,我可以看到阻止书签是下一个活动(大概是由第一个到达那里的人设置的),因此看起来好像第二个接收没有发生。我在 WCF 数据服务中有并发检查代码,但这永远不会触发,因为没有尝试更新数据库。我希望能够警告第二个人,另一个用户先到达那里。
- 我的 Web 应用程序中的主页列表是通过查询应用程序数据库构建的,但是是否可以查询工作流程以查找每个项目的状态,并传递项目的 id(我使用 id 作为相关句柄)?这样做是正常的还是人们通常只是查询应用程序数据库?
I'm trying to model a request submission/ approval /completion scenario. I'm using a flowchart workflow hosted as a service in a console app using WorkflowServiceHost. The workflow has a service reference to a WCF Service hosted in IIS this second service interacts with the application database. I have an aspnet front end with a service reference to the hosted workflow service and call its methods from a proxy client.
The workflow is using a persistence database that I have created using the scripts provided.
The scenario is that a request for a service is made by a user. The request must be approved once by a specific person (I'm using a pick with a delay in one branch to remind the person if no decision arrives, the other branch is receive decision). For some services the request must have a second approval which can be done by any one of a pool of approvers. Once approval is all finished the request goes to a different pool of people for completion.
I have it working but 3 questions:
- In the aspnet home page I have a list of requests with links to pages to approve/complete as appropriate and call methods on the proxy after which they redirect back but because it's all asynchronous I am having to manually refresh the home page to see the changed list. Am I stuck with forcing the page to refresh itself every x seconds to get around this or is there a way to make it synchronous/check state of workflow/wait for a message back? It's not terribly interactive just hitting a button and not knowing whether the action succeeded or not.
- Is there a way to stop someone approving a request just after someone else in the pool has approved it? At the moment nothing happens for the second person when they hit the button (which is good). In the workflow persistence database I can see that the blocking bookmark is the next activity along (presumably set by the person who got there first) so it looks as though the second receive just doesn't happen. I have concurrency checking code in the WCF data service but this never fires because there is no attempt to update the database. I would like to be able to warn the second person that another user got there first.
- My homepage list in the web app is built by querying the application database, but is it possible to query the workflow to find the status of each item, passing the item's id (I'm using the id as the correlation handle)? Is it normal to do this or do people usually just query the application database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)