与 Windows Workflow Foundation (WF4) 集成的异步 Web 客户端
我正在使用 WF4 设计一个工作流程,该工作流程应该由 Web 客户端使用。该工作流聚合 WCF 服务,并由从网页生成的接收活动触发。当工作流正在执行时,用户的Web会话是活动的,并且某些工作流活动可能需要通知用户,即网页需要关于某些工作流阶段的反馈。
我想坚持使用基于 WCF 的活动(发送、接收等),但不太确定如何实现对网页的反馈。假设场景如下:
- 用户单击网页上的“开始”按钮来启动工作流程。
- 工作流服务创建一个工作流实例并使用实例 ID 进行响应。
- 接下来,在服务器上执行“DoSomething”活动。
- 当 DoSomething 完成时,应向用户呈现一个新的网页。 5-NNN。执行其他活动,其中一些还需要反馈。
步骤 1-2 可以使用由 Receive 和 SendReply 组成的 ReceiveAndSendReply 复合活动来实现。 第 3 步是一些很快完成的自定义代码活动 我对步骤 4 的第一个想法是它可以使用 Send 活动来实现,但是 Web 应用程序应该充当 WCF 服务并提供不适合 Web 客户端的端点。还可以如何实施此反馈?
提前致谢
I am designing a workflow using WF4 that is supposed to be consumed by a Web client. The workflow aggregates WCF services and is triggered by a Receive activity that is in turn spawned from a Web page. While the workflow is being executed, the user's Web session is active, and certain workflow activities may need to inform a user, i.e. Web page needs a feedback about certain workflow stages.
I would like to stick to WCF-based activities (Send, Receive etc.), but not quite certain how to implement feedback to a Web page. Let's say this is the scenario:
- User clicks "Start" button on a Web page to start a workflow.
- Workflow service creates a workflow instance and responds with a instance Id.
- Next, "DoSomething" activity is executed on a server
- When DoSomething is completed, user should be presented a new Web page.
5-NNN. Other activities are executed, some of them also requiring feedback.
Steps 1-2 can be implemented using ReceiveAndSendReply compound activity that consists of Receive and SendReply.
Step 3 is some custom Code activity that completes shortly
My first thought about step 4 is that it can be implemented using Send activity, but then Web application should act as a WCF service and provide an endpoint which does not fit a Web client. How else this feedback can be implemented?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最简单的方法是不时对您的网页进行轮询。使用 AJAX 调用检查是否有新内容要显示,如果有,则更新页面。
或者在网页请求工作流并更新其页面后,让它执行另一个调用,该调用只是阻塞,直到有新内容要显示为止。不过,工作流程不能花费太长时间,因为大约 60 秒后调用就会超时。
另一个解决方案可能是尝试使用 Comet,但我没有任何经验与此。
I think the easiest way is to have your web page poll from time to time. Use an AJAX call to check if there is something new to display and if so, update the page.
Or after the web page has requester the workflow and has updated its page, have it do another call that simply blocks until there is something new to show. The workflow can't take too long for that though, because after around 60 seconds the call will simply timeout.
Another solution might be trying to use Comet, but I don't have any experience with that.