How does the pipeline contain multiple decoders and pass parameters?

Skip to first unread message


Jun 7, 2022, 4:24:42 AM6/7/22
to Netty discussions
Hello everyone,
I am new to netty.

I have multiple layers of nested protocols, my idea is to use the first decoder for the first layer, the second decoder for the second layer, and the third decoder for the third layer.

The content of the protocol is as follows:
pid   baseCommonProp1   baseCommonProp2   baseCommonProp3   contentLength content (multiple types of instances, such as multiple drinks, cola, sprite, lemon tea)

But I have the following problem:
1. How to pass the partial objects assembled by the first layer of parsing to the next layer of decoder. I tried to use the decoder's construction method to solve the parameter transfer, but found that the object would not be collected by the garbage collector.
2. Suppose I pass the object to the next decoder through out.add(protocolObject), how to pass the remaining ByteBuf to the next decoder?

Are there any similar examples that I can refer to?

Reply all
Reply to author
0 new messages