Hello, 

I have write a protocol stack with Mina and glad with the behavior of the 
platform unless for one thing that I don't understand. 
May be my question should be sent to developper list but I have may be not 
understood how to deal with ProtocolCodecFilter. 


The ProtocolCodecFilter discussion on mina.org was not helpful. In analyzing 
code, I found that ProtocolCodecFilter calls the encoder to write messages with 
ProtocolCodecOutput and just after do a WriteRequestMessage that is forwarded 
to the filterchain with an emtpy buffer. 
// Now we can try to encode the response 
encoder.encode(session, message, encoderOut); 

// Send it directly 
((ProtocolEncoderOutputImpl)encoderOut).flushWithoutFuture(); 

// Call the next filter 
nextFilter.filterWrite(session, new MessageWriteRequest( writeRequest)); 

Moreover, " messageSent" method forward MessageWriteRequest but not others. 


That should not disturb some people but I think it is annoying for two reasons 
: 
- ProtocolFilterCodec forks an unwanted message (or it is needed but I am not 
aware of it) 
- It does have impact to the filterchain and normal protocol design permits 
total independance of one level of the stack (some filter in the filterchain). 


I deal with it in adding a filter in my filterchain that do not forwards such 
empty message to the rest of the filterchain. 
Did I made it wrong ? 


Cheers, 


Adrien 

Reply via email to