BizTalk开发系列(十一) 在Orchestration中执行Pipeline

更多内容请查看:BizTalk动手实验系列目录

                      BizTalk 开发系列

    由于开发需要有时要在流程中执行Pipeline。比如从DB的某个字段中取消息的字符串并在流程中构造消息。该需要通过pipeline进行升级属性字段,验证消息等处理。BizTalk架构已经开放了此接口: XLANGPipelineManage类,以下为在流程中使用接收和发送端口示例。需在项目中引用Microsoft.XLANGs.Pipeline组件(C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.XLANGs.Pipeline.dll)

clip_image001

1.使用接收管道

  • 在XLANGPipelineManage类中调用ExecuteReceivePipeline()执行接收管道。

            XLangPipelineMangae类中的方法代码:

public static ReceivePipelineOutputMessages ExecuteReceivePipeline(Type receivePipelineType, XLANGMessage inMsg);
  • 在流程中新建一个变量 vRecOut 类型为:ReceivePipelineOutputMessages
  • 新建一个消息 SchMsg 类型为定义的Schema
  • 在构造消息表达式的值为:
vRecOut = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.
ExecuteReceivePipeline(
typeof (TestPipelines.MyRecPipeline),InputMsg); 
SchMsg 
=null//初始化输出消息。
vRecOut .MoveNext(); //IElement的默认方法。
vRecOut .GetCurrent(SchMsg );

TestPipelines.MyRecPipeline 为管道的Fully Qualified Name(完全限定名称),包括命名空间和类名。

InputMsg 为输入的消息,也就是要传到管道处理的消息。

2.使用发送管道

  • 调用ExecuteSendPipeline()执行发送管道。

     XLangPipelineMangae类中的方法代码:

public static void ExecuteSendPipeline(Type sendPipelineType, SendPipelineInputMessages inMessages, XLANGMessage outXLANGMsg);
  • 在流程中新建一个变量 vInMsgs 类型为SendPipelineInputMessages
  • 新建一个消息 SendMsg  类型为Send Pipeline处理之后的消息。
  • 在构造消息的表达式的值为:
vInMsgs.Add(InputMsg);
SendMsg
=null;
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteSendPipeline(
typeof(TestPipelines.MySendPipeline),vInMsgs,SendMsg);

TestPipelines.MySendPipeline为管道的Fully Qualified Name(完全限定名称),包括命名空间和类名。

InputMsg 为输入的消息,也就是要传到管道处理的消息

注意:构造消息需要在构造形状里执行,并且在构造形状的属性里选择要构造的消息否则会报如下错误

     Illegal attempt to update the value of part 'part' in XLANG/s message 'InputMsg' after the message construction was complete

posted on   Gary Zhang  阅读(2479)  评论(3编辑  收藏  举报

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!

导航

点击右上角即可分享
微信分享提示