So first, I added IDisassemblerComponent to the list of interfaces being implemented in my pipeline component class.
Then, I added the following code:
private bool beginMessage = false;
private IPipelineContext pContext;
private IBaseMessage pInMsg;
void IDisassemblerComponent.Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
{
beginMessage = true;
this.pContext = pContext;
this.pInMsg = pInMsg;
}
IBaseMessage IDisassemblerComponent.GetNext(IPipelineContext pContext)
{
if (beginMessage)
{
beginMessage = false;
return Execute(pContext, pInMsg);
}
else
{
return null;
}
}
This will only work if the previous disassembler is supposed to produce one message.
4/29/2010 - Changed the code to reflect changes suggested by Johan Rex...
2 comments:
You may not want to assign the beginMessage variable to false just before you evaluate on it. As it's written th if clause will always evaluate to false and no message will be produced. Not even the first time that I suspect was your intention.
I think you're right...I don't have the original code any more, but I actually did get it working. I guess I posted the wrong version.
Post a Comment