Can custom receive pipeline component drop files to output folder?
-
Wednesday, May 23, 2012 8:21 PM
I'm receiving a flat file and use my receive pipeline component to validate the content. If there is anything wrong, I'd like to drop the flat file to an output folder and stop the process. I know I can create a file and write to it in C#. Does BizTalk have some standard way to do it? How can pipeline stop the process? What pInMsg.BodyPart should be?
Thanks!
All Replies
-
Wednesday, May 23, 2012 8:27 PMModerator
Following two ways IMO:
- In the custom pipeline which you are using to validate the message, write something like
If ( MessageValidated== true)
return pInMsg
Else
// Save the message stream to a folder/archive location using IO methods
return null;
This will return null the to next pipeline stage and message will not be routed to the BizTalk messagebox hence nothing will happen.
- Another way would be,
- In the custom pipeline component, promote some custom context property and attach that with the message only when the message validation gets failed, and use a send port to subscribe the message and save it to a folder location
If ( MessageValidated== true)
return pInMsg
Else
// Promote some custom context property
return pInMsg;
I hope this helps.
HTH,
Naushad Alam
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
alamnaushad.wordpress.com
My new TechNet Wiki "BizTalk Server: Performance Tuning & Optimization"- Edited by Naushad.AlamModerator Wednesday, May 23, 2012 8:29 PM
- Marked As Answer by s liu Wednesday, May 23, 2012 9:35 PM
-
Wednesday, May 23, 2012 8:58 PM
I like the second approach. That way the output location can be configured by the port binding xml instead of hardcoded or extra code that retrieves the configuration from somewhere else.
My concern is my message content is text file instead of xml. So I can promote context properties that are not related to my message content?
Thanks for your response!
-
Wednesday, May 23, 2012 9:32 PMModerator
Yes, Sure you can do that. I have used them a lot.
Below steps you would need
- define a property schema
- define a property
- add code in your custom pipeline component method to promote the custom property , Please refer this similar article.
One more way, Instead of using a custom context property, you can use/promote properties from ErrorReport class and use them.
HTH,
Naushad Alam
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
alamnaushad.wordpress.com
My new TechNet Wiki "BizTalk Server: Performance Tuning & Optimization" -
Wednesday, May 23, 2012 9:52 PMThanks for pointing out another approach!
-
Thursday, June 07, 2012 5:43 PM
Hi,
Ya u can surely do it and it is straight forward.
If there is any error in the flat file you could very easily have the InMsg to a IBaseMessage and promote any property such as MsgType to a custom MessageType and create a send port which has a filter expression of BTS.MessageType=Your Custom MsgType which you promoted.
Have a XML transmit if u need the XML type or have a flat file pipeline to have the output as the Flat file received..
Regards Ritu Raj When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
- Proposed As Answer by Ritu_Raj Thursday, June 07, 2012 5:44 PM

