简体   繁体   English

BizTalk Orchestration 从双向发送端口接收来自 XMLReceive 管道的多条消息?

[英]BizTalk Orchestration to receive multiple messages from XMLReceive pipeline from two-way send port?

I have an orchestration with a two-way send port to retreive one or many items from a database.我有一个带有双向发送端口的编排,可以从数据库中检索一个或多个项目。 I use WCF-SQL adapter, and successfully managed to debatch incoming result into separate StoredProcedureResultSet0 messages.我使用 WCF-SQL 适配器,并成功地将传入的结果分批处理到单独的 StoredProcedureResultSet0 消息中。 However, orchestration only processes one message and ends.但是,编排只处理一条消息并结束。

Is there a way for the receiving orchestration to loop over returned messages before ending?接收编排有没有办法在结束之前循环返回的消息?

Error message I receive now for the unprocessed messages:我现在收到的未处理消息的错误消息:

The instance completed without consuming all of its messages.实例在未消耗其所有消息的情况下完成。 The instance and its unconsumed messages have been suspended.该实例及其未使用的消息已暂停。

I am aware that some people have initiated debatching using pipeline from within the orchestration.我知道有些人已经开始使用编排中的管道进行分批。 I thought that it would be preferable to debatching as close to the source as possible.我认为最好在尽可能靠近源的地方进行分批。

Ideas?想法?

You would have to have a correlation set, where the first receive shape initializes the correlation set, and then you have a receive in a loop with a receive with Following Correlation Set.您必须有一个相关集,其中第一个接收形状初始化相关集,然后您在循环中有一个接收,并带有跟随相关集的接收。 The tricky parts would be determining what you can correlate on and the exit condition of the loop.棘手的部分将是确定您可以关联的内容以及循环的退出条件。 That's why it is usually easier to use a Pipeline or maps in the Orchestration to debatch.这就是为什么在编排中使用管道或映射来分批通常更容易的原因。

Final solution was to do debatching directly in receiving pipeline.最终的解决方案是直接在接收管道中进行分批。 Using XPath in Orchestration have performance risks, and using correlation sets, like @Dijkgraaf answered, also comes with risks.在编排中使用 XPath 存在性能风险,并且使用相关集(如@Dijkgraaf 回答)也存在风险。

However, trying to implement choosen solution, I bounced into the following problem:但是,尝试实施选择的解决方案时,我遇到了以下问题:

XMLReceive pipeline failed to debatch message if there were no results returned from the stored procedure.如果存储过程未返回任何结果,则 XMLReceive 管道无法分批消息。 This is because WCF-SQL adapter omits the resulting element if no rows are returned, and debatching (Body XPath) requires it to exist.这是因为如果没有返回行,WCF-SQL 适配器会忽略结果元素,并且去批处理(Body XPath)需要它存在。 Also, tried to have the Body XPath to work even if there was no results using XPath function count(), but BizTalk does not allow "complex" XPath expressions (given by error message, no reference found). Also, tried to have the Body XPath to work even if there was no results using XPath function count(), but BizTalk does not allow "complex" XPath expressions (given by error message, no reference found).

So, I had to develop a receive decode custom pipeline component to add the element if missing.因此,我必须开发一个接收解码自定义管道组件来添加缺少的元素。 Then XML Disassmebler works and consumes the message even if element is empty.然后 XML Disassmebler 工作并使用消息,即使元素为空。

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

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