Reputation: 14441
Good morning, I'm interested in writing a pipeline component that's aware of the document schema it's decoding. I see there's a function to get to schema information within the component:
IDocumentSpec spec = pContext.GetDocumentSpecByType("name-of-your-schema");
Can you access the document schema name that's assigned in the pipeline?
Upvotes: 2
Views: 2509
Reputation: 498
You can get it from the message's context like so:
private static readonly PropertyBase SchemaStrongNameProperty = new BTS.SchemaStrongName();
private static readonly PropertyBase MessageTypeProperty = new BTS.MessageType();
public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
{
// Get by schema strong name (.NET type)
string schemaStrongName = pInMsg.Context.Read(SchemaStrongNameProperty.Name.Name, SchemaStrongNameProperty.Name.Namespace) as string;
pContext.GetDocumentSpecByName(schemaStrongName);
// Get by message type (XML NS#Root Node)
string messageType = pInMsg.Context.Read(MessageTypeProperty.Name.Name, MessageTypeProperty.Name.Namespace) as string;
pContext.GetDocumentSpecByType(messageType);
// Rest of your pipeline component's code...
}
Upvotes: 4