BizTalk ESB 工具包在编排中进行动态路由

发布于 2024-08-13 15:26:04 字数 3106 浏览 6 评论 0原文

我尝试通过调用接收管道(与提供的 ItinerarySelectReceiveXml 接收端口非常相似)从编排内执行动态行程路由,以解析给定消息的行程并将其发送到 ESB 路由的直接绑定端口。该设置与 CompedMessageProcessor BizTalk 示例类似。

据我所知,我的接收管道与 ItinerarySelectReceiveXml 完全相同,除了 ESB Itinerary Select 管道组件(在 ResolveParty 阶段)外,我已对连接字符串和 ItineraryFactName 进行了硬编码(例如 BRI:\policy=MyResolveItineraryRule;useMsg=true ;recognizeMessageFormat=true; 和 Resolver.Itinerary),这样我就不必使用环回适配器来进行操作并招致额外的消息框访问。

从表达式形状调用接收管道的代码如下所示:

// 我想要路由的第一条消息只是我传入消息上的一个节点

strXPath = "/*[local-name()='BeginConversationMessage' and namespace-uri()='http://MyCompany.BeginConversationMessage.v001']/*[local-name()='BeginConversationMessage' and namespace-uri()='http://MyCompany.BeginConversationMessage.v001']";
BeginConversationMessage = xpath(InboundMsg, strXPath);
RcvPipeOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(MyCompany.Itinerary_GenericSelector), BeginConversationMessage);

这进展得相当顺利,我可以看到消息类型的正确行程正在使用 SQL Profiler 解决了这个问题,我知道行程很好,因为我将它用于具有通用行程入口的消息类型。

但我从 Microsoft.Practices.ESB.PipelineComponents.Dispatcher 中得到一个异常,它紧随 Microsoft.Practices.ESB.Itinerary.PipelineComponents.ItinerarySelector (在解析方阶段)之后出现。

文档指出 ESB Itinerary Selector管道组件应使用以下属性设置行程的 Microsoft BizTalk Server 段:correlationToken、reqRespTransmitPipelineID、interchangeId、receiveInstanceId、epmRRCorrelationToken。

异常如下所示:

值不能为空。 参数名称:interchangeId

源:Microsoft.Practices.ESB.PipelineComponents.Dispatcher

方法:Microsoft.BizTalk.Message.Interop.IBaseMessage 执行(Microsoft.BizTalk.Component.Interop.IPipelineContext、Microsoft.BizTalk.Message.Interop.IBaseMessage)

错误源:Microsoft.Practices.ESB.Itinerary.OM.V1

错误目标站点:System.Object [] GetItineraryDataForBAM(Microsoft.Practices.ESB.Itinerary.OM.V1.Itinerary,Microsoft.Practices.ESB.Itinerary.IItineraryStep,System.String)

错误 StackTrace:位于 Microsoft.Practices.ESB.Itinerary.OM.V1.BAMItineraryProcess.GetItineraryDataForBAM(Itinerary 行程、IItineraryStep 步骤、字符串交换 ID) 在 Microsoft.Practices.ESB.Itinerary.OM.V1.BAMItineraryProcess.SubmitToBAM(Itinerary 行程、IItineraryStep 步骤、IPipelineContext 上下文、IBaseMessage 消息) 在 Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.<>c__DisplayClassa.b__8() 在Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.AdvanceByOrder(ItineraryMessageDirection messageDirection,字符串serviceInstanceId,IItineraryStep步骤,操作submitToBam,布尔advanceStep) 在 Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.Advance(IBaseMessage 消息、IPipelineContext 上下文、IItineraryStep 步骤、布尔 advanceStep) 在 Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.Advance(IBaseMessage 消息、IPipelineContext 上下文、IItineraryStep 步骤) 在 Microsoft.Practices.ESB.PipelineComponents.Dispatcher.Execute(IPipelineContext context, IBaseMessage msg)

任何帮助将不胜感激。

ps 我还在此处将这个问题发布到 ESB 工具包表单 http://social.msdn.microsoft.com/Forums/en/biztalkesb/thread/28c5befe-4c7f-4dc1-a5e7-8fe5b3ec1c75

I'm trying to perform dynamic itinerary routing from within an orchestration by invoking a receive pipeline, much like the provided ItinerarySelectReceiveXml reveive port, to resolve the itinerary for a given message and send it to a direct bound port for ESB routing. The setup is similar to the ComposedMessageProcessor BizTalk sample.

My receive pipeline is exactly like ItinerarySelectReceiveXml, as far as I can see, except on the ESB Itinerary Select pipeline component (in the ResolveParty stage) I've hardcoded the connection string and ItineraryFactName (e.g. BRI:\policy=MyResolveItineraryRule;useMsg=true;recognizeMessageFormat=true; and Resolver.Itinerary) so that I don't have to do tricks with loopback adapters and incur extra messagebox visits.

The code to invoke the receive pipeline from an expression shape is like this:

// The first message I want to route is just a node on my incoming message

strXPath = "/*[local-name()='BeginConversationMessage' and namespace-uri()='http://MyCompany.BeginConversationMessage.v001']/*[local-name()='BeginConversationMessage' and namespace-uri()='http://MyCompany.BeginConversationMessage.v001']";
BeginConversationMessage = xpath(InboundMsg, strXPath);
RcvPipeOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(MyCompany.Itinerary_GenericSelector), BeginConversationMessage);

This goes fairly well, I can see that the correct Itinerary for the message type is being resolved using SQL Profiler, and I know the itinerary is good because I use it for this message type with a generic itinerary on-ramp.

But I'm getting an exception from the Microsoft.Practices.ESB.PipelineComponents.Dispatcher which I have right after the Microsoft.Practices.ESB.Itinerary.PipelineComponents.ItinerarySelector (in the resolve party stage)

The docs state that the ESB Itinerary Selector Pipeline Component should set the Microsoft BizTalk Server segment of the itinerary using the following properties: correlationToken, reqRespTransmitPipelineID, interchangeId, receiveInstanceId, epmRRCorrelationToken.

The exception looks like this:

Value cannot be null.
Parameter name: interchangeId

Source: Microsoft.Practices.ESB.PipelineComponents.Dispatcher

Method: Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext, Microsoft.BizTalk.Message.Interop.IBaseMessage)

Error Source: Microsoft.Practices.ESB.Itinerary.OM.V1

Error TargetSite: System.Object[] GetItineraryDataForBAM(Microsoft.Practices.ESB.Itinerary.OM.V1.Itinerary, Microsoft.Practices.ESB.Itinerary.IItineraryStep, System.String)

Error StackTrace: at Microsoft.Practices.ESB.Itinerary.OM.V1.BAMItineraryProcess.GetItineraryDataForBAM(Itinerary itinerary, IItineraryStep step, String interchangeId)
at Microsoft.Practices.ESB.Itinerary.OM.V1.BAMItineraryProcess.SubmitToBAM(Itinerary itinerary, IItineraryStep step, IPipelineContext context, IBaseMessage msg)
at Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.<>c__DisplayClassa.b__8()
at Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.AdvanceByOrder(ItineraryMessageDirection messageDirection, String serviceInstanceId, IItineraryStep step, Action submitToBam, Boolean advanceStep)
at Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.Advance(IBaseMessage message, IPipelineContext context, IItineraryStep step, Boolean advanceStep)
at Microsoft.Practices.ESB.Itinerary.OM.V1.ItineraryV1.Advance(IBaseMessage message, IPipelineContext context, IItineraryStep step)
at Microsoft.Practices.ESB.PipelineComponents.Dispatcher.Execute(IPipelineContext context, IBaseMessage msg)

Any help would be appreciated.

p.s. I've also posted this question to the ESB Toolkit Form here http://social.msdn.microsoft.com/Forums/en/biztalkesb/thread/28c5befe-4c7f-4dc1-a5e7-8fe5b3ec1c75

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

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

发布评论

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

评论(1

习ぎ惯性依靠 2024-08-20 15:26:04

首先,我认为关键是保留原始消息的上下文。当从管道接收消息时,您需要在构造形状中使用以下语法,以便恢复上下文:

PipelineMessage = null;

RcvPipeOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(
    typeof(MyCompany.Itinerary_GenericSelector), BeginConversationMessage);

RcvPipeOutput.MoveNext();
RcvPipeOutput.GetCurrent(PipelineMessage);
PipelineMessage(*) = BeginConversationMessage(*)

事实上,在编排中的中间消息构造期间,需要始终保留消息上下文。此外,在离开编排之前提升正确的上下文属性也很重要。

这可以通过初始化编排中最后一个发送形状的关联来完成。确保关联包含正确的属性,包括错误消息中提到的属性。

First, I think the key is to preserve the context of the original message. When receiving a message from the pipeline, you need to use the following syntax in a construct shape, in order to restore the context:

PipelineMessage = null;

RcvPipeOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(
    typeof(MyCompany.Itinerary_GenericSelector), BeginConversationMessage);

RcvPipeOutput.MoveNext();
RcvPipeOutput.GetCurrent(PipelineMessage);
PipelineMessage(*) = BeginConversationMessage(*)

In fact, the context of the message needs to be preserved at all times during intermediate message contruction in the orchestration. Also, it is important you promote the right context properties before leaving the orchestration.

This can be done by Initializing a correlation on the last send shape in the orchestration. Make sure the correlation includes the correct properties, including the ones mentioned in the error message.

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