Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Is necessary to handle TCP packet splicing in AvroDecoder? #1

Closed
kb1ns opened this issue Jan 5, 2017 · 2 comments
Closed

Is necessary to handle TCP packet splicing in AvroDecoder? #1

kb1ns opened this issue Jan 5, 2017 · 2 comments

Comments

@kb1ns
Copy link

kb1ns commented Jan 5, 2017

Hi, I have a question about the demo decoder in README.

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        //Do we need to handle TCP splicing here before DatumReader read?
        final NettyByteBufDecoder decoder = new NettyByteBufDecoder(in);
        final DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);
        try {
            final GenericRecord record = reader.read(null, decoder);
            out.add(record);
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    }
@kb1ns
Copy link
Author

kb1ns commented Jan 6, 2017

I figure it out.
GenericRecord#read will keep reading according to the given schema by ByteBufDecoder's ByteBuf until all data arrived.
Is that right?

@kb1ns kb1ns closed this as completed Jan 6, 2017
@kb1ns kb1ns reopened this Jan 6, 2017
@kb1ns kb1ns closed this as completed Jan 8, 2017
@milenkovicm
Copy link
Owner

You do need to handle TCP splicing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants