zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    python关于字典嵌套字典,列表嵌套字典根据值进行排序
    Linux安装pycharm并添加图标到桌面
    python_requests ~爬虫~小视频~~~
    Python如何实现doc文件转换为docx文件?
    python同时取每个列表的第一个元素
    python根据字典的值进行排序:
    lambda 函数的用法
    python的拷贝方式以及深拷贝,浅拷贝详解
    python实现快速排序
    python不使用系统库中的排序方法判断一个数组是否是有序数组
  • 原文地址:https://www.cnblogs.com/cbcye/p/1304018.html
Copyright © 2011-2022 走看看