我目前正在自学 BizTalk 作为新角色的一部分,并掌握了开发业务流程和配置管道的核心概念。 最近,我一直在尝试使用信封模式将包含多个记录的结果集分批到单独的消息中,并最终在上周通过使用以下教程使其工作;
https://learn.microsoft.com/en-us/biztalk/core/walkthrough-using-xml-envelopes-basic https://blog.tallan.com/2014/12/23/typed-polling-with-wcf-adapters/
如果可能的话,我正在寻找一个足够友善的人来让我了解所涉及的机制,以便我可以确认我对整个过程的理解,并将其完全融入到我的解决方案中。
我的理解是: 接收管道正在使用 XML 分解器根据我将接收模式标记为信封的基础来分解我的消息。
这就是我的问题出现的地方。在架构上,我将父节点的 Body XPath 设置为包含结果元素的最终节点之上的节点的 Body XPath。我为什么要这样做,它到底做了什么?
我对结果的模糊理解是,它从底部节点获取结果记录,并使用该 Body XPath 作为在哪里获取子节点/元素来创建新消息的引用?
最佳答案
On the schema, I'm setting the node's Body XPath to that of the node ABOVE the final node containing the result elements. Why am I doing this, and what does it exactly?
My vague grasp of the outcome is that it grabs the resulting record from the bottom node, and uses that Body XPath as a reference on where to obtain the child nodes/elements to create the new message?
我(也?)在理解 Body XPath 一词背后的推理时遇到了一些困难,因为它实际上是您选择的信封。
它的作用:您告诉 BizTalk 该节点下的所有记录都应被视为单独的消息。它不必是单个记录,甚至不必是单一类型的消息。因此,您可以从单个数据源收集一堆不同的消息,并单独处理它们。
它本身不是“最终/底部”节点之上的节点,因为信封可以包含一堆其他类型(如果您想对接收部分进行一些验证)。
您的 first link 中的示例几乎允许主体下面的任何 XML,因为它使用 Any
元素。这意味着我可以在他们的示例中添加一个 Warning
记录:
<Envelope xmlns="http://BasicXMLEnvelope">
<Error>
<ID>102</ID>
<Type>0</Type>
<Priority>High</Priority>
<Description>Sprocket query fails.</Description>
<ErrorDateTime>1999-05-31T13:20:00.000-05:00</ErrorDateTime>
</Error>
<Error>
<ID>16502</ID>
<Type>2</Type>
<Priority>Low</Priority>
<Description>Time threshold exceeded.</Description>
<ErrorDateTime>1999-05-31T13:20:00.000-05:00</ErrorDateTime>
</Error>
<Warning>
<ID>333</ID>
<Description>Just a warning.</Description>
<WarningDateTime>2019-10-07T15:15:00.000+02:00</WarningDateTime>
</Warning>
</Envelope>
使用所描述的分批方法,该单个传入消息将在消息框中产生三个消息;
<Error>
<ID>102</ID>
<Type>0</Type>
<Priority>High</Priority>
<Description>Sprocket query fails.</Description>
<ErrorDateTime>1999-05-31T13:20:00.000-05:00</ErrorDateTime>
</Error>
...和...
<Error>
<ID>16502</ID>
<Type>2</Type>
<Priority>Low</Priority>
<Description>Time threshold exceeded.</Description>
<ErrorDateTime>1999-05-31T13:20:00.000-05:00</ErrorDateTime>
</Error>
...和...
<Warning>
<ID>333</ID>
<Description>Just a warning.</Description>
<WarningDateTime>2019-10-07T15:15:00.000+02:00</WarningDateTime>
</Warning>
...然后您可以订阅。
在我看来,如果您有单一消息源,其中每条消息都发送给另一个目的地(例如不同的客户),或者目的地要求单独发送每条消息(例如目标发票),那么这特别有用每个文件仅允许一张发票的架构)。
此方法的替代方法是一次仅从源中选择一条记录。
关于biztalk - BizTalk 信封模式和分批的说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58265674/