Как я могу использовать компонент camel-netty4
для обработки необработанных байтов, а не textLine? Я пытался использовать:
from("netty4:tcp://{{my.host}}:{{my.port}}?encoder=#myEncoder&decoder=#myDecoder&disconnect=true");
, где
class MyDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
out.add(in.readBytes(in.readableBytes()));
in.retain();
}
}
но я получаю:
Caused by: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
at io.netty.buffer.AbstractReferenceCountedByteBuf.release0(AbstractReferenceCountedByteBuf.java:100) ~[netty-all-4.1.29.Final.jar:4.1.29.Final]
at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:84) ~[netty-all-4.1.29.Final.jar:4.1.29.Final]
at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:88) ~[netty-all-4.1.29.Final.jar:4.1.29.Final]
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:109) ~[netty-all-4.1.29.Final.jar:4.1.29.Final]
... 12 common frames omitted