Netty got some bytes decoders that are length based etc. Search a bit
on what they offer out of the box and you can configure camel netty to
use one of them.

There is also a few of them you can configure from camel-netty using
the ChannelHandlerFactories. You can find some source example at:
http://camel.apache.org/netty4.html

On Tue, Apr 5, 2016 at 4:00 PM, Felipe Gutierrez
<felipe.o.gutier...@gmail.com> wrote:
> Hi,
>
> I am using camel-netty for the first time. I did an example that I can send
> string from telnet and proxy it to the third server. But now I want to
> evaluate to send pure tcp messages and I believe netty assuming to use a
> wrong decoder/encoder. Because I took out "
> &encoder=#stringEncoder&decoder=#stringDecoder" and I receive the first
> messages from the client and after while the client stop to comunicate and
> I receive the errors below. I also believe I need to create a pool of
> request as I see here (
> http://www.mastertheboss.com/jboss-frameworks/netty/use-netty-to-proxy-your-requests),
> but I do not know how to create it using Camel.
>
> In a simple way. I just want to redirect TCP messages from port 3260 to
> 3261, but Camel-Netty is converting my Hex messages to String messages. Is
> there a default en/decoder? or Hex en/decoder?
>
> Regards
>
> package org.camel.netty.first.server;
> import org.apache.camel.builder.RouteBuilder;import
> org.apache.camel.spring.Main;
> public class ServerRouter extends RouteBuilder {
>
>     public static void main(String[] args) throws Exception {
>         Main main = new Main();
>         main.setApplicationContextUri("META-INF/spring/app-context.xml");
>         main.run(args);
>     }
>
>     @Override
>     public void configure() throws Exception {
>         
> from("netty:tcp://localhost:3260?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder")
>
> .to("netty:tcp://localhost:3261?sync=false&allowDefaultCodec=false&encoder=#stringEncoder&decoder=#stringDecoder");
>     }}
>
>
> WARNING: Failed to release a message:
> SimpleLeakAwareByteBuf(UnpooledUnsafeDirectByteBuf(freed))
> io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
>     at 
> io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
>     at io.netty.buffer.WrappedByteBuf.release(WrappedByteBuf.java:820)
>     at 
> io.netty.buffer.SimpleLeakAwareByteBuf.release(SimpleLeakAwareByteBuf.java:34)
>     at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
>     at 
> io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
>     at 
> io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
>     at 
> io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
>     at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
>     at 
> io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
>     at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
>     at 
> io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1059)
>     at 
> io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:688)
>     at 
> io.netty.channel.AbstractChannelHandlerContext.access$1600(AbstractChannelHandlerContext.java:32)
>     at 
> io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:992)
>     at 
> io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
>     at 
> io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
>     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
>     at 
> io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
>     at java.lang.Thread.run(Thread.java:745)
> Apr 04, 2016 2:59:15 PM io.netty.util.ReferenceCountUtil safeRelease
> WARNING: Failed to release a message: UnpooledUnsafeDirectByteBuf(freed)
> io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
>     at 
> io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:101)
>     at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:59)
>     at 
> io.netty.util.ReferenceCountUtil.safeRelease(ReferenceCountUtil.java:84)
>     at 
> io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:276)
>     at 
> io.netty.channel.ChannelOutboundBuffer.failFlushed(ChannelOutboundBuffer.java:473)
>     at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:709)
>     at 
> io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:315)
>     at 
> io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:676)
>     at 
> io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1059)
>     at 
> io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:688)
>     at 
> io.netty.channel.AbstractChannelHandlerContext.access$1600(AbstractChannelHandlerContext.java:32)
>     at 
> io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:992)
>     at 
> io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
>     at 
> io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
>     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
>     at 
> io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
>     at java.lang.Thread.run(Thread.java:745)
>
>
> --
>
> *---- Felipe Oliveira Gutierrez*
>
> *-- skype: felipe.o.gutierrez-- **mail: **felipe.o.gutier...@gmail.com
> <felipe.o.gutier...@gmail.com>*
> *-- site**: **https://sites.google.com/site/felipeogutierrez/Home/diaadia
> <https://sites.google.com/site/felipeogutierrez/Home/diaadia>*
> *-- **lattes: **http://lattes.cnpq.br/8633775775597854
> <http://lattes.cnpq.br/8633775775597854>*



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to