Hi You can look at some of the unit tests of camel-netty as some of them use text protocols.
Also for text based protocols then just set textline=true, and end your string with a new-line to mark the end See the docs On Fri, May 19, 2023 at 2:00 PM Rohan Emmanuel <rohan.emmanue...@gmail.com> wrote: > hi, > thanks for the reply. currently on camel version 3.7.0. > trying this out to get the hang of the netty TCP producer component. > I have an existing server that can only listen on a TCP port. want to be > able to send data to it over the socket. any pointers to existing samples > would be appreciated. > netty component always expects the data to be of the type > "io.netty.buffer.ByteBuf"? > I also tried sending a string, I was able to read the string on the server > only if I convert the exchange body to io.netty.buffer.ByteBuf type > > On Fri, May 19, 2023 at 4:25 PM Claus Ibsen <claus.ib...@gmail.com> wrote: > > > Hi > > > > What Camel version do you use? > > > > Also its bad practice to exchange data as Java objects. Then you have > tight > > coupling and need to ensure class compatibility between client servers. > > There are other more accepted protocols to use today. > > > > > > > > On Fri, May 19, 2023 at 12:02 PM Rohan Emmanuel < > > rohan.emmanue...@gmail.com> > > wrote: > > > > > hi, > > > i have trying to create a route which will write a serialzable java > > object > > > using netty TCP component. > > > The camel route looks like this: > > > <process ref="convert.JSON2JAVA"/> > > > > > > <to uri="netty:tcp://127.0.0.1:2944?requestTimeout=30000"/> > > > > > > but i am not able to read any data on the socket on my server side > which > > is > > > listening on 2944 port . > > > > > > in the log i am seeing the below message > > > ;DEBUG;org.apache.camel.component.netty.NettyProducer;Channel: [id: > > > 0xa68b02a1, L:/127.0.0.1:50407 - R:127.0.0.1/127.0.0.1:2944] writing > > body: > > > Request@482b71db > > > ;TRACE;org.apache.camel.component.netty.NettyProducer;Operation > complete > > > DefaultChannelPromise@5ed89a86(failure: > > > java.lang.UnsupportedOperationException: unsupported message type: > > Request > > > (expected: ByteBuf, FileRegion)) > > > ;TRACE;org.apache.camel.component.netty.NettyProducer;Channel open: > [id: > > > 0xa68b02a1, L:/127.0.0.1:50407 - R:127.0.0.1/127.0.0.1:2944] > > > ;TRACE;org.apache.camel.component.netty.NettyProducer;Exception caught > at > > > Channel: [id: 0xa68b02a1, L:/127.0.0.1:50407 - R: > > 127.0.0.1/127.0.0.1:2944] > > > > > > > > > From the logs, the netty producer is expecting the data in ByteBuf > > format. > > > Should the data be converted explicilty? i tried the "<convertBodyTo > > > type="io.netty.buffer.ByteBuf"/>" but it gives out an error during > > > coversion. > > > > > > can anyone guide me on how to send Java obj data using Netty TCP > > producer.? > > > -- > > > Regards, > > > Rohan Emmanuel > > > > > > > > > -- > > Claus Ibsen > > ----------------- > > @davsclaus > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > > -- > Regards, > Rohan Emmanuel > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2