If you know Netty, please help me. I use Netty and Protobuf to realize information encoding and decoding. How to distinguish different information and call corresponding decoding
The idea is this.
A.proto is responsible for processing the user’s request to send pictures, and b.proto is responsible for processing the user’s text messages.
But how do you invoke different decoding according to different information? Netty, most of what I see is that there is only one ProtobufDecoder responsible for decoding. I hope to be able to call corresponding decoding according to different information. What should I do?
Generally speaking, different decoding methods are called for processing according to the content transmitted by the client.
At the beginning of this year, I encountered such a problem. I was under great pressure. It was my first time to use netty. Please help me, thank you very much.
I don’t know if you can still see, a relatively simple way is to create a large container c,c contains a, b. configure c as decoder, and judge whether it is a or b data through c.hasA and c.hasB after getting the data.