工作流基础 4.0 长时间运行流程中的请求-响应

发布于 2024-12-18 23:37:53 字数 260 浏览 4 评论 0原文

在 WF 4.0 中解决以下问题的最简单方法是什么:

  • 向 WCF 服务发送数据/请求(例如启动进程 X 的请求)
  • 获取响应(简单,反序列化输入的成功/失败),仅指示处理已完成开始了。
  • 在自定义 WF 活动中继续处理(可能需要几分钟)
  • 结束

我的目标是在收到对象后立即将响应发送回 WCF 客户端,并在客户端不等待的情况下处理任何处理。目前,我的顺序工作流程会锁定,直到自定义活动完成后才能继续。

What is the simplest way to solve the following in WF 4.0:

  • Send data/request to a WCF service (for example a request to start process X)
  • Get a response (simple, success/failure of deserializing the input) only indicating that processing has started.
  • Continue processing (could potentially take a few minutes) in a custom WF activity
  • End

My goal is to have the response sent back to the WCF client as soon as the object is received, and handle any processing without the client waiting. Currently, my sequential workflow locks until the custom activity is completed before continuing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初心未许 2024-12-25 23:37:53

您可以将请求发送到 WCF 中的“OneWay”方法来启动处理;

[OperationContract(IsOneWay = true)]

虽然这不会发回响应,但可以假设除非已引发故障,否则该过程已启动。如果你需要指出如果失败了,就抛出一些东西。

然后可以轮询另一种方法来检查初始请求的状态。或者,您可以使用 WCF 回调。

其中一些概念的简介关于单向调用、回调您需要了解的内容、和事件

You could send the request to a 'OneWay' method in WCF to kick off the processing;

[OperationContract(IsOneWay = true)]

While this does not send back a response, it could be assumed that unless a Fault has been raised, the process has started. If you need to indicate that if failed, just throw something.

Another method could then be polled to check the status of the intital request. Alternatively, you could use WCF callbacks.

An introduction into some of these concepts What You Need To Know About One-Way Calls, Callbacks, And Events

不回头走下去 2024-12-25 23:37:53

建议的解决方法是在 f.ex 的响应活动之后添加等待活动。 1秒或更长的时间跨度。这将强制发送响应,并在 1 秒后继续执行。

我不会将此称为解决方案,但可能是唯一的方法。

A suggested workaround is to add a wait activity after the response activity with f.ex. a timespan of 1 second or more. This will force sending of the response, and after 1 second continue the execution.

I would not call this a solution, but might be the only way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文