M4rk
M4rk

Reputation: 2272

Chat Server with Java & Netty

I want to implement a Chat Server with Java and Netty. My question is: should I make all the work in Netty's connection handler? For "all the work" I mean for example: to do the login ( so with mysql connection ), eventually to send message, to log informations..

Upvotes: 2

Views: 1899

Answers (2)

duffymo
duffymo

Reputation: 308998

If you put all that functionality into interface-based POJOs, rather than a Netty connection handler, you'll find it easier to test it without having to fire up Netty.

Once you have all those objects working and tested, then give them to a connection handler and let them do the work. The connection handler just orchestrates your POJOs to fulfill its requests.

Upvotes: 1

corsiKa
corsiKa

Reputation: 82579

I think a more robust design would be to make a system that works without Netty and then use Netty's connection handler to go between the two. This way, if you decide to move away from Netty in the future, you can do so with minimal rewiring.

Upvotes: 3

Related Questions