Not able to use aggregate with Splitter in Camel Version 3.20.0

2023-05-19 Thread Sahil Upneja
Hi Team,

I am not able to use aggregate with Splitter in Camel Version 3.20.0.

*completionSize* is not getting considered when I am using Aggregate inside
the Splitter

Splitter is splitting in batches of 1 only, but I want to split Json array
of large size say 100 into batches of 10.

Below is my code snippet






< from uri : splitter>

$


true





< to uri : transformer>



Can you please suggest how to achieve this.

Thanks & Regards

Sahil


Not able to use aggregate with Splitter

2023-05-19 Thread Sahil Upneja
Hi Team,

*completionSize* is not getting considered when I am using Aggregate inside
the Splitter

Splitter is splitting in batches of 1 only, but I want to split Json array
of large size say 100 into batches of 10.

Below is my code snippet






< from uri : splitter>

$


true





< to uri : transformer>



Can you please suggest how to achieve this.

Thanks & Regards

Sahil


[RESULT][VOTE] Release Apache Camel Kamelets 3.20.4

2023-05-19 Thread Andrea Cosentino
Hello all,

The vote passes with the following results:

4 +1 binding votes: Andrea Cosentino, Claus Ibsen, Babak Vahdat and
Jean-Baptiste Onofrè

I'll go ahead with the process.

Thanks all.


Re: [VOTE] Release Apache Camel Kamelets 3.20.4

2023-05-19 Thread Andrea Cosentino
Thanks the vote passes.

I'll go ahead with the flow.

Il giorno gio 18 mag 2023 alle ore 07:19 Jean-Baptiste Onofré <
j...@nanthrax.net> ha scritto:

> +1 (binding)
>
> Regards
> JB
>
> On Tue, May 16, 2023 at 12:15 PM Andrea Cosentino 
> wrote:
> >
> > Hello all:
> >
> > This is a vote for releasing camel-kamelets 3.20.4
> >
> > Kamelets release files:
> > https://dist.apache.org/repos/dist/dev/camel/camel-kamelets/3.20.4
> > Kamelets staging repository:
> > https://repository.apache.org/content/repositories/orgapachecamel-1554
> > Kamelets Tag:
> > https://github.com/apache/camel/releases/tag/camel-3.20.4
> >
> > Please cast your vote.
> >
> > [ ] +1 Release camel-kamelets 3.20.4
> > [ ] -1 Veto the release (provide specific comments)
> >
> > The vote is open for at least 72 hours.
> >
> > Here's my +1.
> >
> > Thanks,
> > Andrea Cosentino
>


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


3.20.4 Bug(?): Route's ErrorHandler not working if exception happens on Kamelet

2023-05-19 Thread Mikael Koskinen
Hi,

I'm encountering a problem where route configuration's error handler
isn't run if the exception happens on a Kamelet. Here's the gist with
tries to show the issue:
https://gist.githubusercontent.com/mikoskinen/4e3e3a8efdf891890a2a46dfddae1d48/raw/09055bcdc1c2252a77a069fcebd07d6f727db555/camel-yaml-kamelet-errorhandling.yaml

More details:


First, here's a (working) version with no Kamelets:

- routeConfiguration:
errorHandler:
  deadLetterChannel:
deadLetterUri: direct:errorHandler
redeliveryPolicy:
  maximumRedeliveries: 0
- route:
from:
  uri: timer:timer
  steps:
- setBody:
expression:
  constant:
expression: Hello World
- marshal:
json:
  library: jackson
  prettyPrint: true
- to:
uri: https://webhook.site/b7562774-4939-4e90-9337-5b9dd4d2ff1d
- route:
from:
  uri: direct:errorHandler
  steps:
- log:
message: Handling error
loggingLevel: WARN
description: Handle Error

When run, this is what I see in the logs:

2023-05-19 15:14:13.783 WARN 20268 --- [- timer://timer]
testing.camel.yaml:25 : Handling error
2023-05-19 15:14:14.626 WARN 20268 --- [- timer://timer]
testing.camel.yaml:25 : Handling error

It is working as I expected.

Now, with a just one change where HTTP component is changed to Kamelet
HTTP Sink and I'm getting completely different result.

- routeConfiguration:
errorHandler:
  deadLetterChannel:
deadLetterUri: direct:errorHandler
redeliveryPolicy:
  maximumRedeliveries: 0
- route:
from:
  uri: timer:timer
  steps:
- setBody:
expression:
  constant:
expression: Hello World
- marshal:
json:
  library: jackson
  prettyPrint: true
- to:
uri: kamelet:http-sink
parameters:
  url: https://webhook.site/b7562774-4939-4e90-9337-5b9dd4d2ff1d
- route:
from:
  uri: direct:errorHandler
  steps:
- log:
message: Handling error
loggingLevel: WARN
description: Handle Error

Now when run I'm getting the stacktrace and there's no "Handling
error" to be found:

2023-05-19 15:20:22.084 INFO 17192 --- [ main]
el.impl.engine.AbstractCamelContext : Apache Camel 3.20.4 (tes
ting) started in 4s854ms (build:196ms init:3s906ms start:752ms JVM-uptime:8s)
2023-05-19 15:20:23.165 ERROR 17192 --- [- timer://timer]
or.errorhandler.DefaultErrorHandler : Failed delivery for (Mes
sageId: B24BA7702CBB985- on ExchangeId:
B24BA7702CBB985-). Exhausted after delivery atte
mpt: 1 caught: java.net.UnknownHostException: No such host is known
(webhook.site)

Message History

---
Source ID Processor
Elapsed (ms)
testing.camel.yaml:9 route1/route1 from[timer://timer]
2701025406
testing.camel.yaml:11 route1/setBody1 setBody[constant{Hello World}]
2
testing.camel.yaml:15 route1/marshal1
marshal[org.apache.camel.model.dataformat.JsonDa

A bug or do I have to configure something more to get the kamelet to
use the route's error handler?

Best regards,
Mikael


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


Unable to write JAVA object using netty TCP Producer

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