Niklas Therning wrote:
Michael Bauroth wrote:

...

My question: What happens with the output (ProtocolDecoderOutput - POJOs) of different protocol decoders in a chain? Will it be sent directly to the IoSession or can I receive and modify it in other decoders, which are inserted later in the chain?

Sample: ByteBuffer -> TextLineDecoder (works on ByteBuffer) -> (single lines / Strings as POJOs) -> ???? -> OwnDecoder (works on ByteBuffer / POJO ???)


Message objects created by a decoder will passed on to the next filter in the chain. If the ProtocolCodecFilter is the last filter in the chain the decoded message will be passed on to your IoHandler implementation.

You could definitely chain ProtocolCodecFilters which use different decoders. However, you must make sure they are compatible. The first decoders output must be compatible with the second decoders input etc. For example, both TextLineDecoder and the decoders created by DemuxingProtocolCodecFactory expects the input to be ByteBuffers. This means you cannot chain them.

Ok, after reading Trusin's reply I must correct myself. You can chain ProtocolCodecFilters but the second decoder will only be used if the first decoder emitts a ByteBuffer. Otherwise, the second decoder will be ignored.

/Niklas

Reply via email to