Client to Handle Conversation, Presence and Heartbeats

Johnny Luong johnny.luong at trustcommerce.com
Tue Sep 13 14:40:15 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 09/13/2011 07:11 AM, Replicator wrote:
> @Johnny,
> 
>     Great. That is what I was looking for.
>     So the model is to use a SINGLE netty client that will talk back and
> forth to the alien server via different handlers. Where a single handler
> would represent a single action/message of the protocol ( just to decouple
> and map protocol to netty )?
> 
> Thanks for "IdleStateAwareChannelHandler" btw!
> 
> On Mon, Sep 12, 2011 at 9:50 PM, Johnny Luong-2 [via Netty Forums and
> Mailing Lists] <ml-node+s685743n6785901h30 at n2.nabble.com> wrote:
> 
> On 09/12/2011 11:40 AM, Replicator wrote:
> 
>>>> We need to have a client that is consuming messages from from the server
> (
>>>> that we don't control ), and occasionally send messages to the server.
> For
>>>> example:
>>>>
>>>>      1. client sends "I am up" message to the server
>>>>      2. server sends "I know that you are up. Starting to send you stuff"
> 
>>>> message back to the client
>>>>      3. server sends massive number of messages to the client
>>>>      4. meanwhile client and server send each other heartbeats ( on the
> same
>>>> port ) every second.
>>>>
>>>> Which messaging pattern can we use for this client? Or is it just as
> simple
>>>> as having a client with registered upstream and downstream handlers that
>>>> handle heartbeats, presence, etc.. messages?
>>>>
>>>> Thank you!
>>>>
>>>> --
>>>> View this message in context:
> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Client-to-Handle-Conversation-Presence-and-Heartbeats-tp6784800p6784800.html
>>>> Sent from the Netty User Group mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> netty-users mailing list
>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=6785901&i=0>
>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>>
>>>>
> 
> You can use handlers for pretty much all of that.  The examples cover
> upstream and downstream handlers; you might also look at
> SimpleChannelHandler if you are interested in a specific event.  For
> heartbeats, the IdleStateAwareChannelHandler is a useful class to work
> with.
> 
> -Johnny
> 

If the application logic is simple enough, one handler generally
suffices; if not, you would probably need to make architecture decisions
as to what warrants its own separate entity in the chain of
responsibility (e.g: do I want this handler to handle this particular
message).  This could mean using the Netty pipeline in the form of
multiple handlers or having your single handler delegate the operation
to your own internal processing flow.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJOb6OPAAoJENQfv1FjsMMvo58P/0lIv7QhHD57xEwaHSdWwdpT
4S24lvhxh3bxWppoUQnZMEc+KoMKmAK1v+NXTErg/+tknJr9htxsiMd2vj3tyzlU
JLC3tAuRXKGnm2lrAJ4IIIS6+gZTpVgh6JuMkKzQNNxgWEvQOU+kJD6k+eV/6CPE
fTNotjyG/3zu83Sir9Cc6ya/r2NtPASavqzU7lY3O8Ef6ftNQO0j32uUG+9TcJ/C
T6fkpTYzmSBP1IMbPTW6Kikvc402zY1LlG5H9WGpUad2Fb4x7MllF9Y5GZDB4pBn
yDQ/pdklcI2AzTZV6/cEziR6psWZl02s+oIKgMwlh8w9c1xDf9VqXH3qtve4nJsC
YTNB48H5cYNFDootstJ0hVIApJ+4gZAuJ6yw/6yo98Osr/b7tjMAqGTXakjMZNkq
I10qHFwNznUprhm1/HRa6elF75+D/4ADPNo8ODHcUcl1HYPy5VSDRIgvKjbk1X+p
K4ksY6D8sbVb43xKVBhYBIoaRBr0oVNijdn5hHL80YO7AuLw3Sjzzm1TS0Of6GHX
T8+qQ7U8MDma1O/lRQ7B6ybUvcFwcFMddkCm4ujU6bv1ERmYGBlG27+hlHXg7nVC
O9guw7S2OGgwxC6b95H5Ql0oKzIn9D+fDaThDgAgvXrWSSwMUB6v/PvSBbgddQR2
9faQGgbTBmA0gndk+EjI
=QEvL
-----END PGP SIGNATURE-----


More information about the netty-users mailing list