Re: Unable to write JAVA object using netty TCP Producer

2023-05-22 Thread Rohan Emmanuel
hi,
getting an error saying "No response received from remote server" when I
use the "textline=true" option. even though the server is writing data on
the socket. any config or option to be set to be able to read the response?



org.apache.camel.CamelExchangeException: No response received from remote
server: 127.0.0.1:2944. Exchange[3F2C0B1EFB87034-]
at
org.apache.camel.component.netty.handlers.ClientChannelHandler.channelInactive(ClientChannelHandler.java:133)
~[camel-netty-3.7.0.jar:3.7.0]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:819)
~[netty-transport-4.1.55.Final.jar:4.1.55.Final]
at
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
~[netty-common-4.1.55.Final.jar:4.1.55.Final]

On Fri, May 19, 2023 at 6:00 PM Claus Ibsen  wrote:

> 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  >
> 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 
> 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:
> > > >  
> > > >
> > > > 
> > > >
> > > > 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 " > > > 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.

Re: Unable to write JAVA object using netty TCP Producer

2023-05-19 Thread Claus Ibsen
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 
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  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:
> > >  
> > >
> > > 
> > >
> > > 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 " > > 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


Re: Unable to write JAVA object using netty TCP Producer

2023-05-19 Thread Rohan Emmanuel
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  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:
> >  
> >
> > 
> >
> > 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 " > 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


Re: Unable to write JAVA object using netty TCP Producer

2023-05-19 Thread Claus Ibsen
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 
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:
>  
>
> 
>
> 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 " 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