Newbie questions

Ernesto A. eaneiros at gmail.com
Tue Aug 11 09:12:31 EDT 2009


Hello,

> 1. What is the best way to implement reconnecting mechanism for TCP
> client in which the connection with the server should be up at all
> times. I need to send periodic "ping status" messages to the server as
> well. At the start of app I need to connect to host (and retry if host
> is not available), and if the connection goes down I need to reconnect
> up with the server in some smart way (perhaps you have reconnecting
> strategies implemented somewhere in netty code?).

About this first question, I think this part belongs to what in netty
is called the business logic, or the object in your network framework
that will take care of handling connections/disconnections, maintain
session state etc. You should check the javadocs for
SimpleChannelHandler, this class provides exactly what you need
through callbacks. There are plenty of examples about how to use it on
netty's website, I recommend reading the guide first and foremost, so
you could get in touch with netty principles and get an idea of how
things fit together.

> 2. What is the best way to send incoming JMS message payload to the
> server and send back the response to the client via another JMS
> responseQueue? I have a JMS listener which gets the payload from
> requestQueue, and now I guess that I need a local memory queue on which
> to push this data; netty would then check the memory queue and send the
> data to the server if the data if found. Do you have any example for
> this queue mechanism, or any comments if I got this wrong?

I think that after reading the guide and checking the examples you
will get a better idea about how to do all this ;) Also Michael
McGrady sent to the list some great diagrams about the netty
architecture, I don't know if Trustin put them on the website? If not
you should be able to find them on the list archive, if you weren't
subscribed to the list when he sent them. Don't doubt about coming
back with any questions. Best regards, ernesto.

>
> Thanks for the answers and best regards,
>
> Bozo
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>


More information about the netty-users mailing list