简体   繁体   English

CRM自定义工作流程,使用多线程

[英]CRM custom workflow, use multithreads

I want to spin off multithreading in CRM workflow. 我想在CRM工作流程中脱离多线程。 I initially use the IOrganizationService to retrieve a collection of entities. 我最初使用IOrganizationService来检索实体集合。 Based on the collection, I want to perform multiple action on other entities. 根据集合,我想对其他实体执行多个操作。

The problem is that I am not able to get any examples for the same. 问题是我无法得到任何相同的例子。 I get examples but not for anything in an CRM custom workflow. 我得到了示例,但没有在CRM自定义工作流程中的任何内容。 I tried Parallel.ForEach using the single IOrganizationService, creating multiple IOrganizationServices, but in all cases my workflow immediately goes into Waiting state with error thrown. 我尝试使用单个IOrganizationService进行Parallel.ForEach,创建多个IOrganizationServices,但在所有情况下,我的工作流程都会立即进入Waiting状态并抛出错误。

Is this possible to spin off multiple threads in an workflow. 是否可以在工作流中分离多个线程。 If yes can I get some pointers on this. 如果是,我可以得到一些指示。

  • girija 吉里贾

CRM back-end wants to orchestrate parallel operations itself. CRM后端想要自己编排并行操作。 And it makes sense since load on a servers could change dramatically, and CRM should be prepared for that. 这是有道理的,因为服务器上的负载可能会发生巨大变化,而CRM应该为此做好准备。

Some parallel processing is possible, but if it's not involving IOrganizationService . 某些并行处理是可能的,但如果它不涉及IOrganizationService It looks to be not thread-save, and sooner or later will fail if used in parallel processing. 它看起来不是线程保存,如果在并行处理中使用,迟早会失败。

To solve your problem, I believe you need to re-think your approach. 为了解决您的问题,我相信您需要重新思考您的方法。 For example you can spawn many workflow instances and let CRM deal (die, most likely) with this load or, for example, prepare data in advance and process it in parallel without need of calling IOrganizationService . 例如,您可以生成许多工作流实例,并让CRM使用此负载处理(最有可能),或者,例如,提前准备数据并并行处理它而无需调用IOrganizationService

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM