Process different types of messages

bgoetzmann bgoetzmann at sophia.symag.com
Mon Sep 14 12:00:37 EDT 2009


Hello,

In my Netty project whose goal is to transfer large file form a client to a
server, I used an ChunkedWriteHandler instance and a custom client handler
that uses the ChunkedFile class in order to send a file piece by piece. All
is OK!

The next step for me would be to send first some information on the file
that is about to be sent (name, size, etc.). So I need to send a POJO
instance.
What is the approach I can take? Can you tell me if this is a valid
approach, having a POJO that holds the information I want on the file:

* On the client side:
- when connected, add a ObjectEncoder dynamically in the pipeline (or have
it already in the pipeline)
- populates the POJO and send it to server
- remove the ObjectEncoder 
- add the ChunkedWriteHandler in the pipeline
- send the file

* On the server side:
- when connected, add a ObjectDecoder dynamically in the pipeline (or have
it already in the pipeline)
- receive the POJO and process its data
- remove the ObjectDecoder 
- add a custom handler to handle messages containing file pieces

Is there another way to process such scenario? Thank you for any help!


Bertrand.

-- 
View this message in context: http://n2.nabble.com/Process-different-types-of-messages-tp3643445p3643445.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list