Returning null from a Pipeline

In my previous Blog entry titled Accessing Promoted Properties in a Pipeline Component I talked about sending data to a pipeline in order to insert the data into a database.  Once that data was sent to the database I ended up passing the entire incoming message back to the BizTalk engine so that BizTalk could finish its processing. 

 

In that scenario, from a requirements perspective, I really didn't need to send anything back; my processing was finished.  So what I could have done is to process the incoming message in the manner that I needed to and then delete the message.  In other words, one message comes into my pipeline but none will go out.  In order to do this I just need to return null from either the IComponent.Execute, IDisassemblerComponent.GetNext or IAssemblerComponent.Assemble methods.

 

This would look like the following:

 

public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)

{

//do some work with the message

 

return null;

}

Comments

  • Anonymous
    November 17, 2004
    This works very well when you process single messages in the pipeline. If you do this for example after a XML Disassembler that uses an envelope schema to split one message into n messages the first "return null" will stop the whole pipeline. Depending on your business case this might be ok or not. It is just something you have to keep in mind.
    If you need the multi message scenario, you have to write a custom disassembler.
    Regards
    Matthias