一、 定制pipeline的接口
可以定制三种类型的pipeline component:general, assembling,disassembling。
其中disassembling是接收管道的Disassemble阶段使用的pipeline component类型,assembling是发送管道Assemble阶段使用的pipeline component类型,两种管道的其它阶段都是用general类型的pipeline component。
pipeline component是.net或com的组件,用来实现不同阶段的管道任务,根据不同类型的pipeline component类型需要实现一些接口以便消息引擎调用来传送和返回相关信息。
1、 IpipelineContext
传递组件所在管道的上下文,当前所在管道的stage等
组件可以获得消息和消息工厂
这个接口对象是作为参数传入到组件,给组件内部的代码使用,不需要哪个pipeline component去实现这个接口。
2、 IbaseComponent
组件通过这个接口提供这个组件的基本信息:名称、版本、描述
3、 IComponent
General类型的pipeline component必须实现的接口。General类型一般接收一个消息,处理消息,然后返回一个消息。
需要实现方法:
l IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
消息引擎调用此方法把消息传入pipeline component,返回pipeline component处理后的消息。
4、 IpersistPropertyBag
IpersistPropertyBag 接口用来作为环境(开发环境、biztalk控制台等)跟pipeline component的运行时属性交互时,作为设计时属性提供的一组功能。提供设计时环境设置和获得pipeline component属性的功能。
IpersistPropertyBag 接口有两个主要方法:
l void Load(IPropertyBag propertyBag, int errorLog);
环境调用此方法装载所有在环境中保存的pipeline componen属性值。就是在把在开发环境或者biztalk控制台中设置的pipeline componen相关属性值传递给pipeline componen本身。
l void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties);
环境调用此方法把pipeline componen属性值取出来,保存到开发环境或者biztalk控制台的pipeline componen相关属性。
IpropertyBag接口是IpersistPropertyBag接口的两个方法提供的参数类型,不需要pipeline componen实现这个接口。
实际上这个接口就是把pipeline component属性暴露给环境,使用者可以在开发环境或biztalk控制台中随时修改这些暴露的属性,给配置pipeline提供了很大的灵活性。
例如,pipeline componen定义了一个叫Filter的属性:
private string filter = null;
[System.ComponentModel.Description(属性描述)]
public string Filter
{
get { return filter; }
set { filter = value; }
}
如果这个pipeline componen没有实现IpersistPropertyBag接口,组件的Filter属性在环境中能看到,但是在环境中设置了这个属性值在运行时将不会被传送到组件。
看一下如何实现这个接口的两个主要方法:
void IPersistPropertyBag.Load(IPropertyBag propertyBag, int errorLog)
{
object objSheetName = null;
try
[1] [2] [3] [4] [5] 下一页