WF4 - 并行使用多个 ReceiveAndSendReply 活动时出现异常 [英] WF4 -Get exceptions when using multiple ReceiveAndSendReply activities paralleled

查看:25
本文介绍了WF4 - 并行使用多个 ReceiveAndSendReply 活动时出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,想使用多个并行运行的 ReceiveAndSendReply 活动,每个活动都将被置于无限 while 循环中,以确保所有活动始终在运行和监听.所以我使用了一个并行活动来打包所有这些 ReceiveAndSendReply,并且每个 ReceiveAndSendReply 都被放在一个 While 活动中,条件设置为 true.当然,我在 Receive 活动和 SendReplyToRecieve 活动之间放置了一些具有业务逻辑的活动.现在我遇到了一个问题,如果在一个分支中处理请求需要很长时间,那么在此期间所有其他分支都将被阻止.任何对其他 Receive 活动的请求都不会被处理,并且两个客户端,包括一个被调用的 long time run service 和另一个在 server process long run service process 期间调用其他 service 的客户端,也会得到异常.有没有人有解决它的想法?抱歉,因为我是新用户,可以发布我的工作流程图片.

I have a scenario and want to use multiple ReceiveAndSendReply activities running in parallel situation, each of them will be put in an infinite while loop to make sure all activities are always running and listening. So I used a parallel activity to pack all those ReceiveAndSendReply, and each ReceiveAndSendReply was put in a While activity with condition set to true. And of cause, I put some activities with business logic between Receive activity and SendReplyToRecieve activity. Now I have a problem if it takes a long time to process a request in one branch, then during that time all other branches will be blocked. Any request for other Receive activities will not be processed, and both client, which include the one called long time run service and the other one who called other service during server process long time run service process, will also get exceptions. Did anybody have an idea to fix it? Sorry since I am new user, can put post image of my workflow.

推荐答案

工作流运行时是单线程的,因为给定的工作流实例在任何给定时刻只在单个线程上执行.因此,当您的工作流忙于工作时,它无法对其他传入消息做出反应.通常这不是问题,因为工作流通常不是计算密集型的,并且进行异步 IO 非常容易.可能有帮助的一件事是添加具有真正短暂超时的延迟活动.它们会导致工作流暂停,让它开始处理下一个请求.还要确保在 Receive 和 SendReply 之间放置尽可能少的活动,并在 SendReply 之后添加一个短暂的延迟.

The workflow runtime is single treaded in that a given workflow instance only executes on a single thread at any given moment. So while your workflow is busy doing work it can't react to other incoming messages. Normally this isn't a problem as workflow's normally aren't compute intensive and doing async IO is real easy. One thing that might help is adding Delay activities with a real short timeout. They cause the workflow to pause letting it start processing the next request. Also make sure you put as few activities as you can between the Receive and the SendReply and add a short delay right after the SendReply.

这篇关于WF4 - 并行使用多个 ReceiveAndSendReply 活动时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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