I want to implement Slack API client with Netty. Slack has dozens of methods, each with different URL and response format.
Should I create a channel for each of this methods and reuse single bootstrap or should I use single channel for all the communications? I am doing this project to learn Netty, actually, and I cannot understand the strategy from the docs and examples (which are pretty basic).
With channel per API method I can use different handlers to process different datatypes, but with single channel I cannot do that, do I?
Can I store channel as an instance field (of a "client" class) or is it a short-lived object?
Also, what are the memory and CPU impacts of both ways?
For different slack API methods, they have different business logic, but the underlying transport is same. So, from my point of view, you should separate your http logic from business logic.
For example, you can use one handler to process http request/response, and the other handler to process slack method request/response
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With