Re: Simple Language

2023-06-03 Thread Claus Ibsen
What camel version do you use, and what do you have as input and get as
output

On Thu, May 25, 2023 at 8:23 AM Michael Rambichler 
wrote:

> Hi all,
>
> I am struggling with a simple "Simple" Language OGNL use:
>
> I would like to replace a String with a regex via simple
> Please see the following example:
>
> .setHeader("result", simple("${header.CamelFileName.replaceAll('^.*.pdf',
> 'Hello')}"))
>
> But it does not work at all. Do I miss something?
>
> Thanks for any help
>  Michael
>


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


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

2023-06-03 Thread Claus Ibsen
Hi

Yes its a good idea to make kamelets like a "black box" and they should not
have any error handling (noErrorHandler), then
they are like calling a component.

We can add an option to the kamelet component that can turn on old
behaviour for users that somehow want the old way (just in case).
https://issues.apache.org/jira/browse/CAMEL-19411


On Fri, Jun 2, 2023 at 11:40 AM Mikael Koskinen  wrote:

> Hi,
>
> Thank you for the replies. It would be great if the Kamelets could
> inherit the configuration as modifying the Kamelet specifications is
> mostly out of the question as we're using the stock/built-in Kamelets,
> like http-sink etc. I think this is quite a big issue (for me at least
> :)) as it means that we really can't use the Kamelets from our routes
> if we need to deal with errors in a specific way. And we do. The
> documentation states that the Kamelet should act like a
> direct-component but in this regard it doesn't.
>
> Without knowing the internals of Apache Camel that well, I wonder if
> this is something that could be changed on how the Kamelet Component
> is implemented? Would it be possible to pass the route configuration
> to the RouteDefinition, which is (I think) created in the
> Kamelet.java/templateToRoute?
>
> Best regards,
> Mikael
>
> pe 2. kesäk. 2023 klo 11.10 Andrea Cosentino (anco...@gmail.com)
> kirjoitti:
> >
> > But it's not with kamelets it's a plain route
> >
> > Il ven 2 giu 2023, 10:08 Andrea Cosentino  ha
> scritto:
> >
> > > There is one example in the camel-kamelets-example repo:
> > >
> > >
> > >
> https://github.com/apache/camel-kamelets-examples/tree/main/jbang/error-handler
> > >
> > > Il ven 2 giu 2023, 10:03 Pasquale Congiusti <
> pasquale.congiu...@gmail.com>
> > > ha scritto:
> > >
> > >> Hello,
> > >> Error handler should be managed differently in Kamelets. Basically the
> > >> problem is that a Kamelet is a RouteTemplate, so it is like a new
> Route
> > >> and
> > >> won't "inherit" the configuration you've defined in the original
> route. I
> > >> think you need to define your error inside the Kamelet specification
> > >> (which
> > >> it's not a very nice design). In Camel K, we've created a layer on
> top of
> > >> it inside the runtime, in order to let the user define the error
> handling
> > >> in the Binding [1].
> > >>
> > >> We had some draft work [2] to enhance that, expecting a similar global
> > >> mechanism in Camel. However, I haven't followed by near the recent
> > >> developments in Camel 4 to tell you if this is going to be included
> in the
> > >> new version or not.
> > >>
> > >> Regards,
> > >> Pasquale.
> > >>
> > >> [1]
> > >>
> > >>
> https://camel.apache.org/camel-k/1.12.x/kamelets/kameletbindings-error-handler.html
> > >> [2] https://github.com/apache/camel-k-runtime/pull/868
> > >>
> > >> On Fri, Jun 2, 2023 at 7:35 AM Mikael Koskinen 
> > >> wrote:
> > >>
> > >> > Hey,
> > >> >
> > >> > I wonder if anyone has any info regarding this issue? It's possible
> > >> > (and maybe quite likely!) that I'm using the
> > >> > routeConfiguration/errorHandler incorrectly.
> > >> >
> > >> > Thanks in advance.
> > >> >
> > >> > Best regards,
> > >> > Mikael
> > >> >
> > >> > pe 19. toukok. 2023 klo 15.24 Mikael Koskinen (mijap...@gmail.com)
> > >> > kirjoitti:
> > >> > >
> > >> > > 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