Hello, I’m using the <AsyncSinkWriter> and am tryi...
# troubleshooting
m
Hello, I’m using the AsyncSinkWriter and am trying to implement
getSizeInBytes
where
RequestEntryT
is just a plain old java object (POJO) which is made up of ByteArray, String, Int. I can calculate the size by getting the size of the ByteArray and getting the size of the String using Charsets.UTF_8 and then adding 4 bytes for the Int, but it’s not the same size as when I serialize the POJO using
ByteArrayOutputStream
and
DataOutputStream
as there is a little bit of overhead after serialization. So is this okay? I really would prefer to avoid having to serialize the the POJO just to get the size.
y
The docs mention: > This method allows the getting of the size of a RequestEntryT in bytes. The size in this case is measured as the total bytes that is written to the destination as a result of persisting this particular RequestEntryT rather than the serialized length (which may be the same). > I believe this means you should be good with calculating the "naive" size and not size + serialization overhead.
d
Naive size is fine, unless you're using this to adhere to max bytes payload or similar.
m
Awesome thanks guys!