for netty
I have a TCP server based on netty framework that is embedded (as jar file) within my spring boot project.
In fact I want to do some non-blocking activities (for example CRUD in db or calling restful web services) when the following method of tcp netty is called:
channelRead method of ChannelInboundHandlerAdapter class
Which is the best scenario for this mode?
For the "CRUD in db or calling restful web services" I would recommend none of the mentioned. Why not just use Spring for that? I would use netty only if there's absolutely no need to parse responses, i.e. if you work only with strings and/or byte buffers or *maybe* one-three objects that you have to write parsers for. At the point where you see that you need to understand what that web service has just sent to you, you face the need to express your data in object form. Spring+rxjava2 or spring+reactor would be my choice for the task you've described (if I understand it right). Netty is way much lower level
P.S.: one more thing - rx-netty is pretty idle, while rxjava2 was very active from beginning and is very mature at the moment. So, I would use it only as a last option. Digging in bugs of an outdated project that integrates two asynchronous tools... just a "hell" synonym))
Обсуждают сегодня