Biztalk EDI Outbound Batching

 

Biztalk 2006 R2中使用集成的EDI Outbound Batching能够很容易地实现打包发送EDI文档的功能。

 

以下是在EDI Outbound Batching中起重要作用的4Promoted Context

EDI.ToBeBatched

EDI.ToBeRouted

EDI.DestinationPartyID

EDI.EncodingType

以及集成在Biztalk EDI Application中的3Orchestration

Microsoft.BizTalk.Edi.BatchSuspendOrchestration.BatchElementSuspendService

Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService

Microsoft.BizTalk.Edi.RoutingOrchestration.BatchRoutingService

 

在使用EDI Batching之前,首先需要正确的配置PartyInterchange Batch Creation Setting,并且启动Biztalk EDI Application中的以上3Orchestration以及BatchControlMessageRecvPort,如下图,注意需要配置筛选规则,如BTS.ReceivePortName == RecPort1具体可参看http://msdn.microsoft.com/en-us/library/bb226357.aspx


 

 

下面来介绍整个EDI Outbound Batching的处理流程:

 


 

1. 为自动化提升符合条件的上下文,在pipeline需要使用到BatchMaker componentEDI receive pipeline已含有该component,但假如Receive pipeline接收的是非EDI类型的数据,即不会使用到EDI receive pipeline的话就需要自定义一个Receive pipeline,在ResolveParty阶段嵌入BatchMaker component,然后部署到biztalk application中就可以了。当然也可以通过编码手动提升这些上下文。

 

2. 筛选规则中只有一个Party会对Promoted context做以下修改,这样就可以使Batching Orchestration(BatchRoutingService)订阅到这些消息:

EDI.ToBeBatched = True

EDI.DestinationPartyID = %PartyID%

EDI.EncodingType = 0/1   (0 – X12, 1 - EDIFact)

 

3. 筛选规则中有多个Party时,会对Promoted context做以下修改,这样就可以使Routing Orchestration(BatchRoutingService)订阅到这些消息:

EDI.ToBeRouted = True

EDI.DestinationPartyID = %PartyID1% %PartyID2% %PartyID3% (space符分隔)

   

4.  Routing Orchestration会将订阅到的Message按照EDI.DestinationPartyID列表拷贝并分组Transaction Set,这样能保证每一个Party得到一组正确的Transaction Set拷贝,同时会对每一个Transaction SetPromoted context做以下修改,从而可以保证Batching Orchestration订阅到这些消息

EDI.ToBeBatched = True

EDI.DestinationPartyID = %PartyID%

EDI.EncodingType = 0/1  

 

5. Batching Orchestration将订阅所有EDI.ToBeBatched = TrueEDI.DestinationPartyID = %PartyID%EDI.EncodingType = 0/1的以X12EDIFact编码的Transaction Set集合。在EDI Receive pipeline处理消息的时候,BatchMaker componentRouting Orchestration来决定编码类型,这样开发人员可以在BatchMaker的处理动作完成之后使用Biztalk Map或者自定义逻辑来将一个非EDI的消息转换为EDI消息。

 

6. Batching Orchestration会验证Transaction Set,若失败,则将EDI.BatchItemValidationFailure属性设置为True,从而使BatchSuspend orchestration(即BatchElementSuspendService)能够订阅到这些失败的Transaction Set,发出错误信息,同时挂起这些集合。

 

7. 一旦满足了Batch发布的条件,Batch Orchestration会将Transaction Set集合组合起来并加上EDI文件的Envelope

 

8. 待完成了Batching动作之后,Batch Orchestration就会重新设置Promoted context:

EDI.ToBeBatched = False

EDI.DestinationPartyName = %PartyName%

EDI.BatchEncodingType = X12/EDIFact   

 

9. 最后send port就能够订阅到这些已被Batch了的EDI数据。

 

Reference

http://msdn.microsoft.com/en-us/library/bb245977.aspx

 

posted @ 2008-08-19 23:35  Andre  阅读(922)  评论(0编辑  收藏  举报