Netty - Serialising POJOs

179 views
Skip to first unread message

deaconk...@gmail.com

unread,
Sep 6, 2016, 1:51:03 AM9/6/16
to Netty discussions
Hi,

I am just starting to learn NETTY and have a question with regards to using NETTY to encode and decode POJOs.  

All of the examples I can find are really geared around knowing the length of the data coming in and I was wondering if I am serialising and deserialing my POJOs do I need to worry about framing my data or will NETTY take care of it for me.  My POJOs will most be consisting of int's, string and Date objects.  

From initial testing I can serialise a POJO and it comes out fine at the other end and I can access the data, but wanted to make sure once my POJOs get bigger (currently only a few strings for testing) if I need to lean how to do this now.

Thanks,

Deacon.

Norman Maurer

unread,
Sep 6, 2016, 4:15:34 AM9/6/16
to ne...@googlegroups.com
You need to have some kind of "framing" as tcp may fragment data

--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/48b13a45-61b5-4299-ac1e-8d5d11068a06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

deaconk...@gmail.com

unread,
Sep 9, 2016, 8:04:04 PM9/9/16
to Netty discussions
Hi Norman,

Thanks for the tip.  The only thing that I am confused about now is what I have read below in relation to using standard POJO's and Java serialisation :-


The frame decoder knows how to segment the byte stream because it works in concert with the sender'sObjectEncoder, which has conveniently placed length indicators into the downstream byte stream, specifically so the upstream decoder can use them to parse
In the case of the ObjectDecoder, it has it's own frame decoding built in, but in many decoder classes, there is no frame decoding built in and framing support needs to be provided.

My understanding in reading this would be if I use Java serialisation and the standard ObjectEncoder / ObjectDecoder then the framing will be taken car for me.

Or have I misunderstood the above.

Thanks,

Deacon.




On Tuesday, September 6, 2016 at 6:15:34 PM UTC+10, Norman Maurer wrote:
You need to have some kind of "framing" as tcp may fragment data
2016-09-06 7:50 GMT+02:00 <deaconk...@gmail.com>:
Hi,

I am just starting to learn NETTY and have a question with regards to using NETTY to encode and decode POJOs.  

All of the examples I can find are really geared around knowing the length of the data coming in and I was wondering if I am serialising and deserialing my POJOs do I need to worry about framing my data or will NETTY take care of it for me.  My POJOs will most be consisting of int's, string and Date objects.  

From initial testing I can serialise a POJO and it comes out fine at the other end and I can access the data, but wanted to make sure once my POJOs get bigger (currently only a few strings for testing) if I need to lean how to do this now.

Thanks,

Deacon.

--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages