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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值