Stream handling in custom pipeline component
Date: Mon, 14 Jun 2021 11:26:50 +0200
I've created a simple general pipeline which purpose would be to trace out
the message and the message context. This component is allowed to be in the
decode, validate, resolve party, encode stages.
I'm using the Stream s = pInMsg.BodyPart.Data; statement to get the data
stream (according to the documentation the data property clones the oroginal
stream). After it I use a StreamReader class and the ReadToEnd method to
read from the stream. When it is finished I close the stream (i think it is
ok because it is not the original stream).
If this pipeline component is in the decode stage it works just fine. But if
it is in the Validate stage it can read out the message data from the
stream, but BizTalk doesn't get message, and throw an error to the eventlog.
If it is in the encode stage in the send side the components can read the
message but the output message is empty.
The last statement in my IComponent.Execute method is return pInMsg to
always return the original message and context.
What am I doing wrong?