Re: Camel Jbang 4.4.1 not available?

2024-03-22 Thread Mikael Koskinen
Thank you for the quick help! 4.4.1 now installed nicely.

And thank you for the tip regarding how to install a specific app version
using Jbang.

Best regards,
Mikael

pe 22. maalisk. 2024 klo 7.30 Tadayoshi Sato (sato.tadayo...@gmail.com)
kirjoitti:

> Ah Claus already did it. Thanks Claus :-)
>
> On Fri, Mar 22, 2024 at 2:29 PM Tadayoshi Sato 
> wrote:
>
> > Hi,
> >
> > The Camel JBang command looks at this file in the default branch.
> >
> >
> https://github.com/apache/camel/blob/main/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java#L22-L24
> >
> > As you see, it still points to 4.4.0. Someone will soon update it to
> 4.4.1
> > and you should be able to use it.
> >
> > By the way, the latest JBang version allows us to pass additional system
> > properties at `jbang app install`, so you can as well now do this to
> > install a specific version of Camel JBang command:
> >
> >   $ jbang app install -Dcamel.jbang.version=4.4.1 camel@apache/camel
> >
> > Hope it helps,
> >
> > On Fri, Mar 22, 2024 at 2:10 PM Mikael Koskinen 
> > wrote:
> >
> >> Hi,
> >>
> >> I'm trying to install Camel Jbang 4.4.1 but the 4.4.0 always gets
> >> installed. --Force and --fresh parameters don't help.
> >>
> >> jbang app install --force --fresh camel@apache/camel
> >>
> >> I checked the CamelJBang.java and it still seems to refer to 4.4.0, is
> >> this
> >> something that needs to be changed on the source code side?
> >>
> >> I'm not actually that familiar with how the versioning with the Camel
> >> Jbang
> >> works. I assumed that the release of Camel 4.4.1 means that the Camel
> >> Jbang
> >> is also updated to the same version. But now I noticed that there's no
> >> 4.4.1 release for the docker image either, so I assume they have a
> >> different release cadence.
> >>
> >> Specifying the exact version when running a command works, for example:
> >>
> >> jbang --fresh "-Dcamel.jbang.version=4.4.1" camel@apache/camel
> --version
> >>
> >> Best regards,
> >> Mikael
> >>
> >
> >
> > --
> > Tadayoshi Sato
> >
>
>
> --
> Tadayoshi Sato
>


Camel Jbang 4.4.1 not available?

2024-03-21 Thread Mikael Koskinen
Hi,

I'm trying to install Camel Jbang 4.4.1 but the 4.4.0 always gets
installed. --Force and --fresh parameters don't help.

jbang app install --force --fresh camel@apache/camel

I checked the CamelJBang.java and it still seems to refer to 4.4.0, is this
something that needs to be changed on the source code side?

I'm not actually that familiar with how the versioning with the Camel Jbang
works. I assumed that the release of Camel 4.4.1 means that the Camel Jbang
is also updated to the same version. But now I noticed that there's no
4.4.1 release for the docker image either, so I assume they have a
different release cadence.

Specifying the exact version when running a command works, for example:

jbang --fresh "-Dcamel.jbang.version=4.4.1" camel@apache/camel --version

Best regards,
Mikael


Re: Any way to have "Named/Keyed Endpoints" in YAML / Karavan?

2024-03-02 Thread Mikael Koskinen
Hi,

Thank you for the tip, this seems like a good alternative.

The issue that comes to mind is that we have integrations where we are
transferring issues between multiple Jira instances and directly
configuring the components gives issues in these cases.

In the best case scenario we hope we could provide properties like:

ourJira.username = test
ourJira.password = 123456
ourJira.jiraUrl = https://our.atlassian.com/jira
<https://comp.atlassian.com/jira>
theirJira.username = test
theirJira.password = 123456
theirJira.jiraUrl = https://our.atlassian.com/jira
<https://comp.atlassian.com/jira>

And then in the route somehow "auto apply" all these properties into an
endpoint without having to set them one by one. Maybe the ID could be used
in this auto mapping? So something like:

- route:
from:
  uri: jira
  id: ourJira-123
  parameters:
type: NEWISSUES
  steps:
- to:
uri: jira
id: theirJira-93838



to 29. helmik. 2024 klo 23.57 Marat Gubaidullin (marat.gubaidul...@gmail.com)
kirjoitti:

> Hello Mikael
>
> I believe that component configuration in application.properties should
> work, so don't need to duplicate in YAML:
>
> camel.component.jira.jira-url=URL
> camel.component.jira.password=PASSWORD
>
>
> Marat
>
> On Thu, Feb 29, 2024 at 9:00 AM Mikael Koskinen 
> wrote:
>
> > Hi,
> >
> > Property placeholders allow us to reuse single things like Jira username
> > and password. But is there a concept in Camel that works with Camel YAML
> &
> > Karavan where we could reuse "named" endpoint definitions?
> >
> > So the idea is that I could (hopefully in application.properties) define
> > something like:
> >
> > myjira.username = test
> > myjira.password = 123456
> > myjira.jiraUrl = https://comp.atlassian.com/jira
> >
> > And then in my route use this "named/keyed" definition when adding the
> Jira
> > component. So something like:
> >
> > - route:
> > from:
> >   uri: jira
> >   key: "myjira"
> >   parameters:
> > type: NEWISSUES
> >   steps:
> > - to:
> > uri: kamelet:http-sink
> > parameters:
> >   url: https://webhooksite
> >   method: POST
> >
> > The idea is that I could apply all the properties defined in the
> > application.properties to the endpoint instead of having to add the
> > properties one by one.
> >
> > I went through the documentation and found something that is almost
> there:
> >
> >
> https://camel.apache.org/manual/faq/how-do-i-configure-endpoints.html#HowdoIconfigureendpoints-Configuringurisusingendpointwithbeanpropertystyle
> >
> > But then I checked the YAML schema and I don't think it supports these
> > Endpoint-definitions. And if it does, I'm not sure if the Karavan
> designer
> > could keep up with it.
> >
> > So I'm not sure if something like this already exists. Or if I should use
> > Beans? Or is this a new feature idea. Thanks for any tips in advance.
> >
> > Best regards,
> > Mikael
> >
>


Any way to have "Named/Keyed Endpoints" in YAML / Karavan?

2024-02-29 Thread Mikael Koskinen
Hi,

Property placeholders allow us to reuse single things like Jira username
and password. But is there a concept in Camel that works with Camel YAML &
Karavan where we could reuse "named" endpoint definitions?

So the idea is that I could (hopefully in application.properties) define
something like:

myjira.username = test
myjira.password = 123456
myjira.jiraUrl = https://comp.atlassian.com/jira

And then in my route use this "named/keyed" definition when adding the Jira
component. So something like:

- route:
from:
  uri: jira
  key: "myjira"
  parameters:
type: NEWISSUES
  steps:
- to:
uri: kamelet:http-sink
parameters:
  url: https://webhooksite
  method: POST

The idea is that I could apply all the properties defined in the
application.properties to the endpoint instead of having to add the
properties one by one.

I went through the documentation and found something that is almost there:
https://camel.apache.org/manual/faq/how-do-i-configure-endpoints.html#HowdoIconfigureendpoints-Configuringurisusingendpointwithbeanpropertystyle

But then I checked the YAML schema and I don't think it supports these
Endpoint-definitions. And if it does, I'm not sure if the Karavan designer
could keep up with it.

So I'm not sure if something like this already exists. Or if I should use
Beans? Or is this a new feature idea. Thanks for any tips in advance.

Best regards,
Mikael


Re: Camel 4 migration blog post - Feedback welcome

2023-10-06 Thread Mikael Koskinen
Hi,

For me the biggest issues regarding Camel 4 have been when Karavan VS Code
extension updated itself to 4.0.0. I'm not sure things related to Karavan
are discussed in the blog post but here's couple things we've encountered.

In short, if you use Karavan 4.x.x to open a route which has been designed
with the 3.x.x version, in many cases the route breaks as the designer
removes parts of it. I think the yaml schema has changed a bit between the
releases and the editor only supports the latest version with no backward
compatibility. In addition to that, the latest Karavan editor has some
issues UI issues (scrolling the property panel doesn't work as it should,
some textboxes are broken). We decided to downgrade the Karavan back to
3.x.x even though we updated Camel to 4.x.x.

The Camel 4 itself has been a rock solid release. No issues.

pe 6. lokak. 2023 klo 11.52 ski n (raymondmees...@gmail.com) kirjoitti:

> Sure happy to give feedback. I plan to upgrade from 3.20.x to 4.x.
>
> Currently, thus not migrating yet, but planning has started.
>
> The things I need to consider:
>
> - I first need to finish some stuff to upgrade from 2.x to 3.x (Currently
> the docs for 2.0 are gone, is the archive to Camel 2.0 documentation still
> available? Like to compare sometimes.
> - Jakarta stuff in my own code/dependencies.
> - Jakarta stuff in other libraries (then Camel). For example ActiveMQ
> Classic (embedded) server doesn't support it yet.
> - Deprecated components: I use the following components:
>
> camel-atlasmap
> camel-directvm
> camel-elasticsearch-rest
> camel-rabbitmq
> camel-rest-swagger
> camel-websocket
> camel-vm
>
> So I need to change these dependencies and some code here
>
> - I use extendedCamelContext a lot, so need to check the API changes out.
> For example use the PluginHelper instead of the extendedCamelContext
> - Update SLFJ to version 2.0
>
> Will let you know if I'm running into any issues.
>
> I'm planning to use OpenRewrite to update to Spring Boot 3/Jakarta (
> https://docs.openrewrite.org/recipes/java/spring/boot3). If there was a
> recipe to move to Camel 4 then it would be probably easier to do the
> migration.
>
> Raymond
>
>
> On Fri, Oct 6, 2023 at 9:49 AM Claus Ibsen  wrote:
>
> > Hi
> >
> > If you have been migrating to Camel 4 already, then any feedback is
> > welcome.
> >
> > You can comment in the PR, or post here in the mailing list
> > https://github.com/apache/camel-website/pull/1071
> >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>


InterceptSendToEndpoint and access the intercepted endpoint details?

2023-09-06 Thread Mikael Koskinen
Hi,

If I'm intercepting (using InterceptSendToEndpoint) the exchange before it
is sent to an endpoint, can I somehow access the details of the endpoint
which I intercepted?

For example if I have Log-component in my route and I use
InterceptSendToEndpoint to intercept the request, can I somehow check the
details of the intercepted Log-component (like parameters etc.)?

Thank you in advance.

Best regards,
Mikael


Kamelets that use other kamelets?

2023-08-19 Thread Mikael Koskinen
Hi,

Should it be possible to use kamelets from other kamelets? I'm seeing some
errors, making it feel this isn't supported.

The use case is to to have a custom kamelet that handle logins etc. against
a particular API. Then I would like to have a set of more custom kamelets
which abstract away some of the details of the API.

But currently I can't get a simple custom kamelet to work if it tries to
use http-sink or any other "built in" kamelets.

Best regards,
Mikael


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

2023-06-14 Thread Mikael Koskinen
Hi,

Great to hear, thank you!

On Tuesday, June 13, 2023, Claus Ibsen  wrote:

> Hi
>
> Okay so your use-cases will then work out of the box in 3.20.6 onwards.
>
> On Tue, Jun 13, 2023 at 2:59 PM Claus Ibsen  wrote:
>
> > Hi
> >
> > I tracked down what I consider a little bug
> > https://issues.apache.org/jira/browse/CAMEL-19443
> >
> > With the bug fix then this use-case from Mikael works on 3.20.x as well.
> >
> > The other ticket CAMEL-19411 to regard kameelts as "black box" still
> > stands. However this is maybe a different concept that regular route
> > templates that would not.
> > So we may need to consider CAMEL-19411 whether we want to do this in
> Camel
> > v4 or not.
> >
> >
> >
> > On Sat, Jun 3, 2023 at 10:48 AM Claus Ibsen 
> wrote:
> >
> >> 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.

Re: Issue in resolving endpoint with property having period

2023-06-09 Thread Mikael Koskinen
Hi,

Does the following syntax work:

from("timer:notification?period={{time:1000}}")

pe 9. kesäk. 2023 klo 12.21 Sujeet Singh (sujeetkumarsi...@gmail.com) kirjoitti:
>
> Hi,
> The same issue was reported in stackoverflow 11 months ago.
>
> java - Using Timer Component with Apache Camel and the period Query
> Parameter results in error: Error binding property (period=10) with name:
> period on bean: - Stack Overflow
> 
>
> Thanks & Regards,
> Sujeet
>
> On Thu, Jun 8, 2023 at 12:56 PM Sujeet Singh 
> wrote:
>
> > Hi,
> >
> > I switched to 3.14.8 from 3.2.0
> >
> > I am getting this extra information which was absent earlier
> >
> > Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
> > converter available to convert from type: java.lang.String to the required
> > type: java.time.Duration with value 5000
> >
> > Thanks & Regards,
> > Sujeet
> >
> > On Wed, 7 Jun 2023, 19:08 ski n,  wrote:
> >
> >> It's route information that is needed. If the route xml is provided then
> >> it's easier to take a look at it.
> >>
> >> BTW are you really running it on 3.2.0? (It's best to use 3.20.5, or at
> >> least to go to 3.14.8)
> >>
> >> On Wed, Jun 7, 2023 at 3:30 PM Sujeet Singh 
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > It is something like below.
> >> >
> >> > public class FeedLauncher{
> >> > public static void main(String[] args){
> >> >ApplicationContext context =
> >> >
> >> >
> >> ClassPathXmlApplicationContext("spring/tc-feedloader-camel-spring-ctx.xml");
> >> >SpringCamelContext camleContext = new SpringCamelContext();
> >> >camelContext.setApplicationContext(context);
> >> >camelContext.start();
> >> > }
> >> > tc-feedloader-camel-spring-ctx.xml
> >> > 
> >> > 
> >> > 
> >> >  >> > resource="classpath:spring/tc-feedloader-idempotent-spring-ctx.xml"/>
> >> > 
> >> > 
> >> > tc-feedloader-context.xml
> >> > 
> >> > 
> >> > 
> >> >  >> >   base-package=""/>
> >> > 
> >> >
> >> >
> >> > The route information is stored in database and using JPA we are
> >> extracting
> >> > and configuring it.
> >> >
> >> > We are really stuck on this though it works very well with Camel 2.x
> >> >
> >> > Thanks & Regards,
> >> > Sujeet
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > On Mon, Jun 5, 2023 at 7:37 PM ski n  wrote:
> >> >
> >> > > Hi Sujeet,
> >> > >
> >> > > Can you add the complete route, so it's clear where you are using it?
> >> > >
> >> > > Regards,
> >> > >
> >> > > Raymond
> >> > >
> >> > > On Mon, Jun 5, 2023 at 3:50 PM Sujeet Singh <
> >> sujeetkumarsi...@gmail.com>
> >> > > wrote:
> >> > >
> >> > > > Hi,
> >> > > >
> >> > > > I am trying to migrate from Camel 2.x to
> >> > > > Camel 3.2.0. I have followed all the
> >> > > > guidelines but getting the below error
> >> > > > during startup.
> >> > > >
> >> > > > Caused by org.apache.camel.ResolveEndpointFailedException: Failed to
> >> > > > resolve endpoint: timer://notification?fixedRate=true=5000
> >> due
> >> > to:
> >> > > > Error binding property (period = 5000) with name: period on bean:
> >> > > > timer://notification?fixedRate=true=5000 with  value: 5000
> >> > > >
> >> > > > If I remove period from above endpoint it starts working. Same thing
> >> > > > happens for time, maxAge etc.
> >> > > >
> >> > > > Any help would be appreciated.
> >> > > >
> >> > > > Thanks & Regards,
> >> > > > Sujeet
> >> > > >
> >> > >
> >> >
> >>
> >


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

2023-06-02 Thread Mikael Koskinen
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 
> > 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:
> >> > > fr

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

2023-06-01 Thread Mikael Koskinen
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]
> 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


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


Camel Jbang & JSON Logging & ExchangeId as mdc/ndc?

2023-05-11 Thread Mikael Koskinen
Hi,

I'm wondering if it would be possible to include ExchangeId into log
messages when using Camel Jbang to run integration with JSON Logging?

The idea is to be able to group the log messages by the exchange.

Currently the ExchangeId is included in the "message" field when an
error happens:

 "message": "Failed delivery for (MessageId:
4762099352DD338-0001 on ExchangeId:
4762099352DD338-0001). Exhausted after delivery attempt: 1
caught: org.apache.camel.http.base.HttpOperationFailedException: HTTP
operation failed invoking https://we

The JSON logging seems to use EcsLayout:

{
  "@timestamp": "${json:timestamp}",
  "log.level": "${json:level}",
  "message": "${json:message}",
  "process.thread.name": "${json:thread:name}",
  "log.logger": "${json:logger:name}",
  "labels": "${json:mdc}",
  "tags": "${json:ndc}",
  "error.type": "${json:exception:className}",
  "error.message": "${json:exception:message}",
  "error.stack_trace": "${json:exception:stackTrace:text}"
}


And I think the mdc (labels) or ndc (tags) could be a suitable place
to hold this information.

Also the idea is that if my integration contains a Log step:

- log:
message: Handling stuff ${header.stuffNo}
loggingLevel: DEBUG

When logged using the JSON Logging this also would contain the
ExchangeId in mdc/ndc.

What do you think?

Best regards,
Mikael


JQ: Function strftime/1 does not exist

2023-04-17 Thread Mikael Koskinen
Hi,

When using the following JQ expression:

now | strftime("%Y-%d-%m")

I get the following error:

  CaughtExceptionType: org.apache.camel.RuntimeCamelException
CaughtExceptionMessage:
net.thisptr.jackson.jq.exception.JsonQueryException: Function
strftime/1 does not exist  StackTrace:
org.apache.camel.RuntimeCamelException:
net.thisptr.jackson.jq.exception.JsonQueryException: Function
strftime/1 does not exist
at 
org.apache.camel.language.jq.JqExpression.evaluate(JqExpression.java:198)
at 
org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45)

I checked the following project (which I think Camel uses?)
https://github.com/eiiches/jackson-jq and based on the documentation,
I think it should support strftime:

https://github.com/eiiches/jackson-jq/blob/ad9dba1eb618640cf8c72634a5ee99c04ddc8e5b/README.md?plain=1#L530

Also tested in this format but same issue:

strftime("-MM-dd")

Here's a link to jqplayground which shows how the function should work:

https://jqplay.org/s/tl0HuDi71wF

Best regards,
Mikael


Re: KameletBinding & CloudEvents & Camel JBang & Documentation

2023-02-22 Thread Mikael Koskinen
Hi,

Ok, thanks for the detailed explanation.

I was intrigued to find out that Camel-K contains the support for
transforming the messages into CloudEvents and the experimentation was
if I could somehow leverage that feature outside the Camel-K. But now
I wonder if I could just use the KNative component as it (I think)
seems to be one creating the CloudEvents..

Anyways, I really appreciate the response, thank you!

Best regards,
Mikael

ke 22. helmik. 2023 klo 16.03 Pasquale Congiusti
(pasquale.congiu...@gmail.com) kirjoitti:
>
> Hi Mikael,
> yes, there are important differences when running *any* Camel application
> (not only KameletBindings) via Camel JBang or via Kamel CLI. First of all,
> in the first case you're running the application locally and you're using
> your local JVM to run it. The scaffolding and creation of the Maven project
> is done by camel CLI and the execution is local using Camel-Main. When you
> run via kamel, you're running your application remotely, building it on the
> cluster (with a different mechanics of Camel JBang), preparing all
> Kubernetes configuration and finally running the runtime as a Camel-Quarkus
> application.
>
> For your specific case, the local execution misses some important piece
> required to convert the messages in CloudEvents. Running it remotely (and
> also probably with a KNative profile) will do all the transformation
> required. That's the reason why you don't see the messages transformed in a
> local execution.
>
> Cheers,
> Pasquale.
>
> On Wed, Feb 22, 2023 at 2:33 PM Mikael Koskinen  wrote:
>
> > Hi,
> >
> > I'm wondering if KameletBinding works differently if run through Camel
> > JBang vs running the binding using Camel-K.
> >
> > The documentation states that if I use http or https-endpoint as a
> > sink, I should receive a CloudEvent from the source but this doesn't
> > seem to be the case based on my testing using the Camel JBang. That's
> > why I'm wondering if there's a difference between Camel-K and the CLI
> > or if the documentation is missing a step.
> >
> > Here's the part from the documentation:
> > ---
> > the uri option is also conventionally used in Knative to specify a
> > non-kubernetes destination. To comply with the Knative specifications,
> > in case an "http" or "https" URI is used, Camel will send CloudEvents
> > to the destination.
> > ---
> >
> > To test this I created the following binding:
> >
> > apiVersion: camel.apache.org/v1alpha1
> > kind: KameletBinding
> > metadata:
> >   name: test-binding
> > spec:
> >   source:
> > ref:
> >   kind: Kamelet
> >   apiVersion: camel.apache.org/v1alpha1
> >   name: file-watch-source
> > properties:
> >   filePath: c:/temp/kamel
> >   events: CREATE
> >   sink:
> > uri: https://webhook.site/7e80a696-5d47-4a03-8507-1fe4e47cfec6
> >
> > And used the CLI to run this: camel run hmm.yaml
> >
> > The binding itself works but instead of CloudEvents the sink is
> > receiving just the exchange body.
> >
> > Any ideas if there's a step missing? Thanks in advance.
> >
> > Best regards,
> > Mikael
> >


KameletBinding & CloudEvents & Camel JBang & Documentation

2023-02-22 Thread Mikael Koskinen
Hi,

I'm wondering if KameletBinding works differently if run through Camel
JBang vs running the binding using Camel-K.

The documentation states that if I use http or https-endpoint as a
sink, I should receive a CloudEvent from the source but this doesn't
seem to be the case based on my testing using the Camel JBang. That's
why I'm wondering if there's a difference between Camel-K and the CLI
or if the documentation is missing a step.

Here's the part from the documentation:
---
the uri option is also conventionally used in Knative to specify a
non-kubernetes destination. To comply with the Knative specifications,
in case an "http" or "https" URI is used, Camel will send CloudEvents
to the destination.
---

To test this I created the following binding:

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: test-binding
spec:
  source:
ref:
  kind: Kamelet
  apiVersion: camel.apache.org/v1alpha1
  name: file-watch-source
properties:
  filePath: c:/temp/kamel
  events: CREATE
  sink:
uri: https://webhook.site/7e80a696-5d47-4a03-8507-1fe4e47cfec6

And used the CLI to run this: camel run hmm.yaml

The binding itself works but instead of CloudEvents the sink is
receiving just the exchange body.

Any ideas if there's a step missing? Thanks in advance.

Best regards,
Mikael


Re: Using Java processors/aggregators with YAML & Camel JBang

2023-02-15 Thread Mikael Koskinen
Hey,

Few minutes later...

camel run aggregator.yaml Aggregator.java

Seems to work. I kind of thought that the files given to the run
command are just integration files but this is good.

Now, if there's a possibility to include the Aggregator.java inside
the aggregator.yaml somehow, that would be great :)

Best regards,
Mikael

to 16. helmik. 2023 klo 8.21 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Hi,
>
> I'm trying but failing to use Java processors/Java classes when
> writing integrations with YAML and running them with Camel JBang.
>
> I started by cloning this example:
> https://github.com/apache/camel-karavan/tree/main/karavan-demo/aggregator
>
> But running with using simple:
>
> camel run aggregator.yaml
>
> Gives an error:
> Failed to create route route1 at: >>> PollEnrich[simple{file:file_src?noo
> p=true}] <<< in route:
> Route(route1)[From[timer:test?delay=1000=3000] -> [Se...
> because of Cannot find Aggregatio
> nStrategy in Registry with name: #aggregator
>
> So I checked the documentation and I found this mention:
>
> https://camel.apache.org/manual/camel-jbang.html#_using_java_beans_and_processors
> ---
> There is basic support for including regular Java source files
> together with Camel routes, and let Camel JBang runtime compile the
> Java source. This means you can include smaller utility classes,
> POJOs, Camel Processors and whatnot that the application needs.
> ---
>
> I think I could package the java-file into a jar and then use that as
> a dependency but I would like to use java-files if possible. And if
> possible, embedding them inside the YAML sounds interesting.
>
> I think I'm missing something simple as it is still early morning but
> if anyone has any tips to offer, I'm happy for the assistance.
>
> Kind regards,
> Mikael


Using Java processors/aggregators with YAML & Camel JBang

2023-02-15 Thread Mikael Koskinen
Hi,

I'm trying but failing to use Java processors/Java classes when
writing integrations with YAML and running them with Camel JBang.

I started by cloning this example:
https://github.com/apache/camel-karavan/tree/main/karavan-demo/aggregator

But running with using simple:

camel run aggregator.yaml

Gives an error:
Failed to create route route1 at: >>> PollEnrich[simple{file:file_src?noo
p=true}] <<< in route:
Route(route1)[From[timer:test?delay=1000=3000] -> [Se...
because of Cannot find Aggregatio
nStrategy in Registry with name: #aggregator

So I checked the documentation and I found this mention:

https://camel.apache.org/manual/camel-jbang.html#_using_java_beans_and_processors
---
There is basic support for including regular Java source files
together with Camel routes, and let Camel JBang runtime compile the
Java source. This means you can include smaller utility classes,
POJOs, Camel Processors and whatnot that the application needs.
---

I think I could package the java-file into a jar and then use that as
a dependency but I would like to use java-files if possible. And if
possible, embedding them inside the YAML sounds interesting.

I think I'm missing something simple as it is still early morning but
if anyone has any tips to offer, I'm happy for the assistance.

Kind regards,
Mikael


ProducerTemplate (or something similar) support in Camel JBang?

2023-01-31 Thread Mikael Koskinen
Hi,

I've been wondering if it would be possible or a good idea to add
something like the ProducerTemplate to Camel JBang? I mean the ability
to send messages to running integrations using the CLI.

Use case for me would be a scenario where I could start direct
endpoints when our application starts and then in specific points use
the CLI to send messages to these endpoints for processing.

Best regards,
Mikael


Re: Jira Source Kamelet / Jira component & 3.20.1: Could not find artifact com.atlassian.sal:sal-api:jar:4.4.2 in central (https://repo1.maven.org/maven2)/

2023-01-28 Thread Mikael Koskinen
Hi,

Thank you for the quick response and for the help!

I wonder if it would be possible for the tooling (Camel JBang?) to
handle the cases where additional Maven repositories are needed? As a
person who mainly uses Karavan to create the integrations and Camel
JBang as the tool to run them, I was quite clueless of what was going
on.

Couple quick ideas come to mind:
* Maybe a quick dirty mapping directly coded into the tooling: If Jira
is needed, automatically add Atlassian repo etc.
* Some new metadata in the Kamelets / Components could be used to give
the tooling the required information of additional repositories.

I wonder, given there are hundreds of components, is the
Jira/Atlassian a special case or are there some other component &
repositories that will have the similar issues?

Thanks again and have a nice weekend.

Best regards,
Mikael

la 28. tammik. 2023 klo 19.40 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> atlassian does not release to maven central so you need to add their maven
> repo to jbang or have it pre downloaded.
>
> lør. 28. jan. 2023 kl. 17.54 skrev Mikael Koskinen :
>
> > Hi,
> >
> > I'm trying to get the Jira component to work but without success. The
> > error I'm getting is:
> >
> > Caused by: java.lang.IllegalArgumentException: Cannot find component
> > with name: jira. Did you mean: gora, irc, jcr, jpa, mina
> >
> > And from the stacktrace I can see the following:
> >
> > Caused by: org.eclipse.aether.resolution.ArtifactResolutionException:
> > The following artifacts could not be resolved:
> > com.atlassian.sal:sal-api:jar:4.4.2, com.atlassian.jira:j
> > ira-rest-java-client-api:jar:5.2.4,
> > com.atlassian.jira:jira-rest-java-client-core:jar:5.2.4: Could not
> > find artifact com.atlassian.sal:sal-api:jar:4.4.2 in central
> > (https://r
> > epo1.maven.org/maven2)
> > at
> > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:431)
> > ~[maven-resolver-impl-1.8.2.jar:1.8.2]
> > at
> > org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:235)
> > ~[maven-resolver-impl-1.8.2.jar:1.8.2]
> > at
> > org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:357)
> > ~[maven-resolver-impl-1.8.2.jar:1.8.2]
> > at
> > org.apache.camel.main.download.MavenDependencyDownloader.resolveDependenciesViaAether(MavenDependencyDownloader.java:1190)
> > ~[camel-kamelet-main-3.20.1.jar:3.20.1]
> > at
> > org.apache.camel.main.download.MavenDependencyDownloader.lambda$doDownloadDependency$0(MavenDependencyDownloader.java:365)
> > ~[camel-kamelet-main-3.20.1.jar:3.20.1]
> >
> >
> > Here's a simple YAML to reproduce the issue:
> >
> > apiVersion: camel.apache.org/v1
> > kind: Integration
> > metadata:
> >   name: logger-test
> > spec:
> >   flows:
> > - route:
> > from:
> >   uri: jira:WATCHUPDATES
> >   parameters:
> > jiraUrl: https://company.atlassian.net/jira
> > jql: project=CamelTest
> >   steps:
> > - to:
> > uri: >-
> >
> > http://https://webhook.site/73458678-284f-4c01-a8b8-d3c09a7df
> >
> > And here's one way to run it:
> >
> > jbang run "-Dcamel.jbang.version=3.20.1" --fresh camel@apache/camel
> > run example.yaml
> >
> > Best regards,
> > Mikael
> >
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Jira Source Kamelet / Jira component & 3.20.1: Could not find artifact com.atlassian.sal:sal-api:jar:4.4.2 in central (https://repo1.maven.org/maven2)/

2023-01-28 Thread Mikael Koskinen
Hi,

I'm trying to get the Jira component to work but without success. The
error I'm getting is:

Caused by: java.lang.IllegalArgumentException: Cannot find component
with name: jira. Did you mean: gora, irc, jcr, jpa, mina

And from the stacktrace I can see the following:

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException:
The following artifacts could not be resolved:
com.atlassian.sal:sal-api:jar:4.4.2, com.atlassian.jira:j
ira-rest-java-client-api:jar:5.2.4,
com.atlassian.jira:jira-rest-java-client-core:jar:5.2.4: Could not
find artifact com.atlassian.sal:sal-api:jar:4.4.2 in central
(https://r
epo1.maven.org/maven2)
at 
org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:431)
~[maven-resolver-impl-1.8.2.jar:1.8.2]
at 
org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:235)
~[maven-resolver-impl-1.8.2.jar:1.8.2]
at 
org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:357)
~[maven-resolver-impl-1.8.2.jar:1.8.2]
at 
org.apache.camel.main.download.MavenDependencyDownloader.resolveDependenciesViaAether(MavenDependencyDownloader.java:1190)
~[camel-kamelet-main-3.20.1.jar:3.20.1]
at 
org.apache.camel.main.download.MavenDependencyDownloader.lambda$doDownloadDependency$0(MavenDependencyDownloader.java:365)
~[camel-kamelet-main-3.20.1.jar:3.20.1]


Here's a simple YAML to reproduce the issue:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: logger-test
spec:
  flows:
- route:
from:
  uri: jira:WATCHUPDATES
  parameters:
jiraUrl: https://company.atlassian.net/jira
jql: project=CamelTest
  steps:
- to:
uri: >-

http://https://webhook.site/73458678-284f-4c01-a8b8-d3c09a7df

And here's one way to run it:

jbang run "-Dcamel.jbang.version=3.20.1" --fresh camel@apache/camel
run example.yaml

Best regards,
Mikael


Re: How to get docker stats ?

2023-01-11 Thread Mikael Koskinen
Hey,

Can you use PollEnrich to work around this? Here's an example in YAML:

- route:
from:
  uri: timer:test
  steps:
- pollEnrich:
expression:
  constant:
expression: docker:stats?containerId=fa05264a1bed
- to:
uri: log:logger
  parameters:
period: '5000'

Best regards,
Mikael

ke 11. tammik. 2023 klo 17.02 Mark Webb (elihusma...@gmail.com) kirjoitti:
>
> Yes, you are correct.  I had the consumer/producer backwards in my email.
>
> I'll look into writing up a PR.
>
> Thanks,
> Mark
>
>
>
> On Wed, Jan 11, 2023 at 9:18 AM Claus Ibsen  wrote:
>
> > Hi
> >
> > I think you swap the camel consumer vs producer.
> >
> > from = consumer
> > to = producer
> >
> > So you want a on-demand get status in a producer (eg to)
> >
> > to docker:status?id=aaa
> >
> > If so then maybe see if you can add that to the camel-docer and send a PR
> > and create a JIRA
> >
> > On Wed, Jan 11, 2023 at 2:42 PM Mark Webb  wrote:
> >
> > > I have a Docker instance running multiple containers.  I'm trying to
> > figure
> > > out how to get stats for each container.  The problem I've run in to is
> > > that the Docker stats operation is only a producer so I can only use the
> > > "from" in a route.  So if I don't know the container ID at build time,
> > how
> > > can I inject the container ID in a "from" line to follow the
> > producer-only
> > > requirement to get Docker container stats.
> > >
> >
> >
> > --
> > Claus Ibsen
> > -
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >


Re: Camel JBang OpenAPI to REST DSL generator issue with enums: Unsupported field: allowableValues

2022-12-29 Thread Mikael Koskinen
Hey,

Unfortunately I don't have the ASF Jira account and the registration
to Jira is disabled so I can't submit the ticket.

Best regards,
Mikael

to 29. jouluk. 2022 klo 21.12 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> Yeah it smells like a yaml-dsl bug, can you create a JIRA ticket
>
> On Thu, Dec 29, 2022 at 10:24 AM Mikael Koskinen  wrote:
>
> > Hey,
> >
> > Just a quick update: Here's a minimal gist which shows the issue:
> >
> > camel run
> > https://gist.github.com/mikoskinen/dccfffd7b6fa6d95f5a0bce66e491765
> >
> > Hope this helps.
> >
> > Best regards,
> > Mikael
> >
> > to 29. jouluk. 2022 klo 11.08 Mikael Koskinen (mijap...@gmail.com)
> > kirjoitti:
> > >
> > > Hi,
> > >
> > > I'm testing the Camel JBang 3.20 OpenAPI to REST generator and
> > > encountering some issues with enums when trying to run the generated
> > > file. The schema in the error message looks peculiar when trying to
> > > run the XML DSL as it points to spring but I'm not sure if it should
> > > look like that.
> > >
> > > Error with XML Rest DSL:
> > > org.apache.camel.RuntimeCamelException:
> > > org.apache.camel.xml.io.XmlPullParserException: Unexpected element
> > > '{http://camel.apache.org/schema/spring}allowableValues'
> > >
> > > Error with YAML Rest DSL:
> > > Unsupported field: allowableValues
> > >  in file:myroutes.yaml, line 124, column 11:
> > >   value:
> > >
> > > More information follows:
> > >
> > > I'm using the PetStore OpenAPI 3 spec:
> > >
> > https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml
> > >
> > > I'm generating the REST DSL using:
> > >
> > > camel generate rest -i openapi.yaml -o myroutes.yaml
> > >
> > > The generation goes through without errors. But Camel isn't able to
> > > parse the generated file when trying to run the routes using camel run
> > > myroutes.yaml:
> > >
> > > ---
> > > Unsupported field: allowableValues
> > >  in file:myroutes.yaml, line 124, column 11:
> > >   value:
> > >   ^
> > >
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.handleUnknownProperty(YamlDeserializerBase.java:132)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:126)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializationContext$1.construct(YamlDeserializationContext.java:171)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asType(YamlDeserializerSupport.java:344)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asCollection(YamlDeserializerSupport.java:322)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatCollection(YamlDeserializerSupport.java:298)
> > > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatList(YamlDeserializerSupport.java:277)
> > > at
> > org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$GetDefinitionDeserializer.setProperty(ModelDeserializers.java:5563)
> > > ---
> > >
> > > The generated file contains this which based on the error is failing:
> > >
> > > get:
> > > - id: "findPetsByStatus"
> > >   path: "/pet/findByStatus"
> > >   description: "Multiple status values can be provided with comma
> > > separated strings"
> > >   produces: "application/xml,application/json"
> > >   param:
> > >   - dataType: "string"
> > > defaultValue: "available"
> > > description: "Status values that need to be considered for
> > filter"
> > > name: "status"
> > > required: false
> > > type: "query"
> > > allowableValues:
> > >   value:
> > >   - "available"
> > >   - "pending"
> > >   - "sold"
> > >   to: "direct:findPetsByStatus"
> > >
> > > The original OpenAPI spec has this:
> > >
> > >   /pet/findByStatus:
> > 

Re: Camel JBang OpenAPI to REST DSL generator issue with enums: Unsupported field: allowableValues

2022-12-29 Thread Mikael Koskinen
Hey,

Just a quick update: Here's a minimal gist which shows the issue:

camel run https://gist.github.com/mikoskinen/dccfffd7b6fa6d95f5a0bce66e491765

Hope this helps.

Best regards,
Mikael

to 29. jouluk. 2022 klo 11.08 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Hi,
>
> I'm testing the Camel JBang 3.20 OpenAPI to REST generator and
> encountering some issues with enums when trying to run the generated
> file. The schema in the error message looks peculiar when trying to
> run the XML DSL as it points to spring but I'm not sure if it should
> look like that.
>
> Error with XML Rest DSL:
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element
> '{http://camel.apache.org/schema/spring}allowableValues'
>
> Error with YAML Rest DSL:
> Unsupported field: allowableValues
>  in file:myroutes.yaml, line 124, column 11:
>   value:
>
> More information follows:
>
> I'm using the PetStore OpenAPI 3 spec:
> https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml
>
> I'm generating the REST DSL using:
>
> camel generate rest -i openapi.yaml -o myroutes.yaml
>
> The generation goes through without errors. But Camel isn't able to
> parse the generated file when trying to run the routes using camel run
> myroutes.yaml:
>
> ---
> Unsupported field: allowableValues
>  in file:myroutes.yaml, line 124, column 11:
>   value:
>   ^
>
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.handleUnknownProperty(YamlDeserializerBase.java:132)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:126)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializationContext$1.construct(YamlDeserializationContext.java:171)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asType(YamlDeserializerSupport.java:344)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asCollection(YamlDeserializerSupport.java:322)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatCollection(YamlDeserializerSupport.java:298)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatList(YamlDeserializerSupport.java:277)
> at 
> org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$GetDefinitionDeserializer.setProperty(ModelDeserializers.java:5563)
> ---
>
> The generated file contains this which based on the error is failing:
>
> get:
> - id: "findPetsByStatus"
>   path: "/pet/findByStatus"
>   description: "Multiple status values can be provided with comma
> separated strings"
>   produces: "application/xml,application/json"
>   param:
>   - dataType: "string"
> defaultValue: "available"
> description: "Status values that need to be considered for filter"
> name: "status"
> required: false
> type: "query"
> allowableValues:
>   value:
>   - "available"
>   - "pending"
>   - "sold"
>   to: "direct:findPetsByStatus"
>
> The original OpenAPI spec has this:
>
>   /pet/findByStatus:
> get:
>   tags:
> - pet
>   summary: Finds Pets by status
>   description: Multiple status values can be provided with comma
> separated strings
>   operationId: findPetsByStatus
>   parameters:
> - name: status
>   in: query
>   description: Status values that need to be considered for filter
>   required: false
>   explode: true
>   schema:
> type: string
> enum:
>   - available
>   - pending
>   - sold
> default: available
>
> I also tried generating XML DSL and it gives the following error when running:
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element
> '{http://camel.apache.org/schema/spring}allowableValues'
>
> I tried to find the relevant parts from the Apache Camel's source code
> and AFAIK it tries to handle allowableValues. The schema in the XML
> error looks strange though with a reference to spring. Should that be
> rest instead?
>
> Everything works OK with a simpler schema
> (https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore.yaml)
>
> Is this a known issue or is there some setting I could change to make
> things work? Thanks in advance!
>
> Best regards,
> Mikael


Camel JBang OpenAPI to REST DSL generator issue with enums: Unsupported field: allowableValues

2022-12-29 Thread Mikael Koskinen
Hi,

I'm testing the Camel JBang 3.20 OpenAPI to REST generator and
encountering some issues with enums when trying to run the generated
file. The schema in the error message looks peculiar when trying to
run the XML DSL as it points to spring but I'm not sure if it should
look like that.

Error with XML Rest DSL:
org.apache.camel.RuntimeCamelException:
org.apache.camel.xml.io.XmlPullParserException: Unexpected element
'{http://camel.apache.org/schema/spring}allowableValues'

Error with YAML Rest DSL:
Unsupported field: allowableValues
 in file:myroutes.yaml, line 124, column 11:
  value:

More information follows:

I'm using the PetStore OpenAPI 3 spec:
https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml

I'm generating the REST DSL using:

camel generate rest -i openapi.yaml -o myroutes.yaml

The generation goes through without errors. But Camel isn't able to
parse the generated file when trying to run the routes using camel run
myroutes.yaml:

---
Unsupported field: allowableValues
 in file:myroutes.yaml, line 124, column 11:
  value:
  ^

at 
org.apache.camel.dsl.yaml.common.YamlDeserializerBase.handleUnknownProperty(YamlDeserializerBase.java:132)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:126)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializationContext$1.construct(YamlDeserializationContext.java:171)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asType(YamlDeserializerSupport.java:344)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asCollection(YamlDeserializerSupport.java:322)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatCollection(YamlDeserializerSupport.java:298)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatList(YamlDeserializerSupport.java:277)
at 
org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$GetDefinitionDeserializer.setProperty(ModelDeserializers.java:5563)
---

The generated file contains this which based on the error is failing:

get:
- id: "findPetsByStatus"
  path: "/pet/findByStatus"
  description: "Multiple status values can be provided with comma
separated strings"
  produces: "application/xml,application/json"
  param:
  - dataType: "string"
defaultValue: "available"
description: "Status values that need to be considered for filter"
name: "status"
required: false
type: "query"
allowableValues:
  value:
  - "available"
  - "pending"
  - "sold"
  to: "direct:findPetsByStatus"

The original OpenAPI spec has this:

  /pet/findByStatus:
get:
  tags:
- pet
  summary: Finds Pets by status
  description: Multiple status values can be provided with comma
separated strings
  operationId: findPetsByStatus
  parameters:
- name: status
  in: query
  description: Status values that need to be considered for filter
  required: false
  explode: true
  schema:
type: string
enum:
  - available
  - pending
  - sold
default: available

I also tried generating XML DSL and it gives the following error when running:

org.apache.camel.RuntimeCamelException:
org.apache.camel.xml.io.XmlPullParserException: Unexpected element
'{http://camel.apache.org/schema/spring}allowableValues'

I tried to find the relevant parts from the Apache Camel's source code
and AFAIK it tries to handle allowableValues. The schema in the XML
error looks strange though with a reference to spring. Should that be
rest instead?

Everything works OK with a simpler schema
(https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore.yaml)

Is this a known issue or is there some setting I could change to make
things work? Thanks in advance!

Best regards,
Mikael


Re: Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-28 Thread Mikael Koskinen
Hi,

Ok, thanks! In the future I'm happy to submit pull requests. Just need
to get the Camel development environment up and running.

The reason for turning off "remove all routes" was that I was trying
to see if it was possible to live reload just the changed route, not
all. I created five routes each in its own file, using YAML. I then
enabled live reload and by default changing one of the files caused
all the routes to reload. Turning off "remove all routes" seemed to
give the desired result where only the changed route was reloaded.

Thanks again!

ti 27. jouluk. 2022 klo 15.03 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> I have just fixed that to be !route so the WARN is only logged when no
> custom id has been set.
>
> On Mon, Dec 26, 2022 at 4:08 PM Claus Ibsen  wrote:
>
> > Hi
> >
> > Ah yeah it should be NOT custom id assigned.
> > You are welcome to send a PR
> >
> > BTW is there a reason you turn off remove all routes?
> >
> >
> > So the code should be like:
> >
> > if (!route.isCustomId()) {
> >
> >
> >
> > On Mon, Dec 26, 2022 at 2:40 PM Mikael Koskinen 
> > wrote:
> >
> >> Hi again,
> >>
> >> I checked the source code of RouteWatcherReloadStrategy from here:
> >>
> >> https://github.com/apache/camel/blob/00526e77bfa88bc20bcde640487cf7d83629e49d/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java#L274
> >>
> >> To me it looks like the warning "Routes with no id's detected"... is
> >> always printed if there are routes with custom ids:
> >>
> >> for (String id : ids) {
> >> Route route = getCamelContext().getRoute(id);
> >> if (route.isCustomId()) {
> >> sj.add(route.getEndpoint().getEndpointUri());
> >> }
> >> }
> >> if (sj.length() > 0) {
> >> LOG.warn(
> >> "Routes with no id's detected. Its
> >> recommended to assign route id's to your routes so Camel can reload
> >> the routes correctly.\nUnassigned routes:\n{}",
> >> sj);
> >> }
> >>
> >> ma 26. jouluk. 2022 klo 15.30 Mikael Koskinen (mijap...@gmail.com)
> >> kirjoitti:
> >> >
> >> > Hey,
> >> >
> >> > Hmm, I'm not sure. The unit test you linked seems to use the "id"
> >> > field like I used when defining the route. But the assert uses
> >> > "routeId".  For example the test:
> >> >
> >> > when:
> >> > loadRoutes '''
> >> > - route:
> >> > id: demo-route < Here's the "id" field
> >> > def "load route inlined camelCase"() {
> >> >
> >> > But in the assert:
> >> >
> >> > context.routeDefinitions.size() == 1
> >> >
> >> > with(context.routeDefinitions[0], RouteDefinition) {
> >> > routeId == 'demo-route' <- Here's routeId instead of "id"
> >> >
> >> > But as I previously tested, Karavan uses "id".
> >> >
> >> > In the first message I posted the log seems to state that "id" is the
> >> > way to go as Camel reports when starting the route:
> >> >
> >> > 2022-12-26 11:28:42.504  INFO 79551 --- [
> >> > main]e.camel.impl.engine.AbstractCamelContext :     Started firstRoute
> >> >
> >> > Where "firstRoute" is the "id". But the problem is that when live
> >> > reloading happens, Camel reports that no id has been set. Even though
> >> > in the previous line it states that the route with id "firstRoute" has
> >> > been started.
> >> >
> >> > ma 26. jouluk. 2022 klo 14.58 Claus Ibsen (claus.ib...@gmail.com)
> >> kirjoitti:
> >> > >
> >> > > Hi
> >> > >
> >> > > See some unit tests
> >> > >
> >> https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/RoutesTest.groovy#L198
> >> > >
> >> > > You can also use Apache Camel Karavan to design yaml routes as it
> >> builds
> >> > > the YAML correct
> >> > >
> >> > >
> >>

Re: Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-26 Thread Mikael Koskinen
Hi again,

I checked the source code of RouteWatcherReloadStrategy from here:
https://github.com/apache/camel/blob/00526e77bfa88bc20bcde640487cf7d83629e49d/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java#L274

To me it looks like the warning "Routes with no id's detected"... is
always printed if there are routes with custom ids:

for (String id : ids) {
Route route = getCamelContext().getRoute(id);
if (route.isCustomId()) {
sj.add(route.getEndpoint().getEndpointUri());
}
}
if (sj.length() > 0) {
LOG.warn(
"Routes with no id's detected. Its
recommended to assign route id's to your routes so Camel can reload
the routes correctly.\nUnassigned routes:\n{}",
sj);
}

ma 26. jouluk. 2022 klo 15.30 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Hey,
>
> Hmm, I'm not sure. The unit test you linked seems to use the "id"
> field like I used when defining the route. But the assert uses
> "routeId".  For example the test:
>
> when:
> loadRoutes '''
> - route:
> id: demo-route < Here's the "id" field
> def "load route inlined camelCase"() {
>
> But in the assert:
>
> context.routeDefinitions.size() == 1
>
> with(context.routeDefinitions[0], RouteDefinition) {
> routeId == 'demo-route' <- Here's routeId instead of "id"
>
> But as I previously tested, Karavan uses "id".
>
> In the first message I posted the log seems to state that "id" is the
> way to go as Camel reports when starting the route:
>
> 2022-12-26 11:28:42.504  INFO 79551 --- [
> main]e.camel.impl.engine.AbstractCamelContext : Started firstRoute
>
> Where "firstRoute" is the "id". But the problem is that when live
> reloading happens, Camel reports that no id has been set. Even though
> in the previous line it states that the route with id "firstRoute" has
> been started.
>
> ma 26. jouluk. 2022 klo 14.58 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
> >
> > Hi
> >
> > See some unit tests
> > https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/RoutesTest.groovy#L198
> >
> > You can also use Apache Camel Karavan to design yaml routes as it builds
> > the YAML correct
> >
> >
> >
> > On Mon, Dec 26, 2022 at 12:09 PM Mikael Koskinen  wrote:
> >
> > > Thanks! I tried routeId and route-id but got the following error on both:
> > >
> > > Unsupported field: routeId
> > >  in file:timers.yaml, line 2, column 5:
> > > routeId: firstRoute
> > > ^
> > >
> > > at
> > > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:128)
> > > at
> > > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:33)
> > > at
> > > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> > > at
> > > org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:215)
> > >
> > > This is the route:
> > >
> > > - route:
> > > routeId: firstRoute
> > > from:
> > > uri: "timer:yaml"
> > > parameters:
> > > period: "2000"
> > > steps:
> > > - setBody:
> > > constant: "Hello Camel from yaml timer 300"
> > > - log: "${body}"
> > >
> > > If I use Karavan to set the ID of the route, it sets the "id" field:
> > >
> > > - route:
> > > from:
> > > uri: timer:yaml
> > > steps:
> > > - setBody:
> > > expression:
> > > constant:
> > > expression: Hello Camel from yaml timer 300
> > > - log:
> > > message: ${body}
> > > parameters:
> > > period: '2000'
> > > id: routeIdFromKaravan
> > >
> > >
> > > ma 26. jouluk. 2022 klo 12.02 Claus Ibsen (claus.ib...@gmail.com)
> > > kirjoitti:
> > > >
> > > > And it can use camelCase too, so routeId or route-id are both possible.
> > > > However routeId is recommended so you use same case as XML, Java DSL 
> > > > etc.
> > > >
> > > > O

Re: Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-26 Thread Mikael Koskinen
Hey,

Hmm, I'm not sure. The unit test you linked seems to use the "id"
field like I used when defining the route. But the assert uses
"routeId".  For example the test:

when:
loadRoutes '''
- route:
id: demo-route < Here's the "id" field
def "load route inlined camelCase"() {

But in the assert:

context.routeDefinitions.size() == 1

with(context.routeDefinitions[0], RouteDefinition) {
routeId == 'demo-route' <- Here's routeId instead of "id"

But as I previously tested, Karavan uses "id".

In the first message I posted the log seems to state that "id" is the
way to go as Camel reports when starting the route:

2022-12-26 11:28:42.504  INFO 79551 --- [
main]e.camel.impl.engine.AbstractCamelContext : Started firstRoute

Where "firstRoute" is the "id". But the problem is that when live
reloading happens, Camel reports that no id has been set. Even though
in the previous line it states that the route with id "firstRoute" has
been started.

ma 26. jouluk. 2022 klo 14.58 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> See some unit tests
> https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/RoutesTest.groovy#L198
>
> You can also use Apache Camel Karavan to design yaml routes as it builds
> the YAML correct
>
>
>
> On Mon, Dec 26, 2022 at 12:09 PM Mikael Koskinen  wrote:
>
> > Thanks! I tried routeId and route-id but got the following error on both:
> >
> > Unsupported field: routeId
> >  in file:timers.yaml, line 2, column 5:
> > routeId: firstRoute
> > ^
> >
> > at
> > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:128)
> > at
> > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:33)
> > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> > at
> > org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:215)
> >
> > This is the route:
> >
> > - route:
> > routeId: firstRoute
> > from:
> > uri: "timer:yaml"
> > parameters:
> > period: "2000"
> > steps:
> > - setBody:
> > constant: "Hello Camel from yaml timer 300"
> > - log: "${body}"
> >
> > If I use Karavan to set the ID of the route, it sets the "id" field:
> >
> > - route:
> > from:
> > uri: timer:yaml
> > steps:
> > - setBody:
> > expression:
> > constant:
> > expression: Hello Camel from yaml timer 300
> > - log:
> > message: ${body}
> > parameters:
> > period: '2000'
> > id: routeIdFromKaravan
> >
> >
> > ma 26. jouluk. 2022 klo 12.02 Claus Ibsen (claus.ib...@gmail.com)
> > kirjoitti:
> > >
> > > And it can use camelCase too, so routeId or route-id are both possible.
> > > However routeId is recommended so you use same case as XML, Java DSL etc.
> > >
> > > On Mon, Dec 26, 2022 at 11:00 AM Claus Ibsen 
> > wrote:
> > >
> > > > Hi
> > > >
> > > > Use route-id to set id for routes
> > > >
> > > >
> > > > On Mon, Dec 26, 2022 at 10:38 AM Mikael Koskinen 
> > > > wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> I'm testing how the route reload works if one file has multiple
> > > >> routes. I've defined two routes in a single file and assigned ids to
> > > >> both:
> > > >>
> > > >> - route:
> > > >> id: firstRoute
> > > >> from:
> > > >> uri: "timer:yaml"
> > > >> parameters:
> > > >> period: "2000"
> > > >> steps:
> > > >> - setBody:
> > > >> constant: "Hello Camel from yaml timer 30"
> > > >> - log: "${body}"
> > > >>
> > > >> - route:
> > > >> id: secondRoute
> > > >> from:
> > > >> uri: "timer:yaml"
> > > >> parameters:
> > > >> period: "3000"
> > > >> steps:
> > > >> - setBody:
> > > >> constant: "Hello Camel from yaml timer this one"
> > > >> - log: "${body}"
> > > >>
> > > >>

Re: Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-26 Thread Mikael Koskinen
I checked the YAML DSL schema for RouteDefinition and it doesn't seem
to have the routeId field, only id:

https://github.com/apache/camel/blob/796e58cd27a07b91c5690cac977356788ba7a03a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json#L2546

ma 26. jouluk. 2022 klo 13.08 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Thanks! I tried routeId and route-id but got the following error on both:
>
> Unsupported field: routeId
>  in file:timers.yaml, line 2, column 5:
> routeId: firstRoute
> ^
>
> at 
> org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:128)
> at 
> org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:33)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
> at 
> org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:215)
>
> This is the route:
>
> - route:
> routeId: firstRoute
> from:
> uri: "timer:yaml"
> parameters:
> period: "2000"
> steps:
> - setBody:
> constant: "Hello Camel from yaml timer 300"
> - log: "${body}"
>
> If I use Karavan to set the ID of the route, it sets the "id" field:
>
> - route:
> from:
> uri: timer:yaml
> steps:
> - setBody:
> expression:
> constant:
> expression: Hello Camel from yaml timer 300
> - log:
> message: ${body}
> parameters:
> period: '2000'
> id: routeIdFromKaravan
>
>
> ma 26. jouluk. 2022 klo 12.02 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
> >
> > And it can use camelCase too, so routeId or route-id are both possible.
> > However routeId is recommended so you use same case as XML, Java DSL etc.
> >
> > On Mon, Dec 26, 2022 at 11:00 AM Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > Use route-id to set id for routes
> > >
> > >
> > > On Mon, Dec 26, 2022 at 10:38 AM Mikael Koskinen 
> > > wrote:
> > >
> > >> Hi,
> > >>
> > >> I'm testing how the route reload works if one file has multiple
> > >> routes. I've defined two routes in a single file and assigned ids to
> > >> both:
> > >>
> > >> - route:
> > >> id: firstRoute
> > >> from:
> > >> uri: "timer:yaml"
> > >> parameters:
> > >> period: "2000"
> > >> steps:
> > >> - setBody:
> > >> constant: "Hello Camel from yaml timer 30"
> > >> - log: "${body}"
> > >>
> > >> - route:
> > >> id: secondRoute
> > >> from:
> > >> uri: "timer:yaml"
> > >> parameters:
> > >> period: "3000"
> > >> steps:
> > >> - setBody:
> > >> constant: "Hello Camel from yaml timer this one"
> > >> - log: "${body}"
> > >>
> > >> When I run the routes I can see the ids:
> > >>
> > >> 2022-12-26 11:28:42.504  INFO 79551 --- [   main]
> > >> e.camel.impl.engine.AbstractCamelContext : Started firstRoute
> > >> (timer://yaml)
> > >> 2022-12-26 11:28:42.504  INFO 79551 --- [   main]
> > >> e.camel.impl.engine.AbstractCamelContext : Started secondRoute
> > >> (timer://yaml)
> > >>
> > >> Then I've enabled live reload using application.properties with
> > >> camel.main.routes-reload-remove-all-routes set to false. Here's the
> > >> full application.properties:
> > >>
> > >> # routes to load
> > >> camel.main.routes-reload-enabled = true
> > >> camel.main.routes-reload-directory = file:./
> > >> camel.main.routes-reload-pattern = *.yaml
> > >> camel.main.routes-reload-remove-all-routes = false
> > >>
> > >> Now when I use Camel Jbang to run the routes:
> > >>
> > >> camel run timers.yaml
> > >>
> > >> I can see the route ids and the mention that live reload is enabled:
> > >>
> > >> 2022-12-26 11:32:03.051  INFO 79751 --- [   main]
> > >> upport.FileWatcherResourceReloadStrategy : Live route reloading
> > >> enabled (directory: .)
> > >> 2022-12-26 11:32:03.073  INFO 79751 --- [   main]
> > >> e.camel.impl.engine.AbstractCamelContext : Routes startup (

Re: Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-26 Thread Mikael Koskinen
Thanks! I tried routeId and route-id but got the following error on both:

Unsupported field: routeId
 in file:timers.yaml, line 2, column 5:
routeId: firstRoute
^

at 
org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:128)
at 
org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:33)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65)
at 
org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:215)

This is the route:

- route:
routeId: firstRoute
from:
uri: "timer:yaml"
parameters:
period: "2000"
steps:
- setBody:
constant: "Hello Camel from yaml timer 300"
- log: "${body}"

If I use Karavan to set the ID of the route, it sets the "id" field:

- route:
from:
uri: timer:yaml
steps:
- setBody:
expression:
constant:
expression: Hello Camel from yaml timer 300
- log:
message: ${body}
parameters:
period: '2000'
id: routeIdFromKaravan


ma 26. jouluk. 2022 klo 12.02 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> And it can use camelCase too, so routeId or route-id are both possible.
> However routeId is recommended so you use same case as XML, Java DSL etc.
>
> On Mon, Dec 26, 2022 at 11:00 AM Claus Ibsen  wrote:
>
> > Hi
> >
> > Use route-id to set id for routes
> >
> >
> > On Mon, Dec 26, 2022 at 10:38 AM Mikael Koskinen 
> > wrote:
> >
> >> Hi,
> >>
> >> I'm testing how the route reload works if one file has multiple
> >> routes. I've defined two routes in a single file and assigned ids to
> >> both:
> >>
> >> - route:
> >> id: firstRoute
> >> from:
> >> uri: "timer:yaml"
> >> parameters:
> >> period: "2000"
> >> steps:
> >> - setBody:
> >> constant: "Hello Camel from yaml timer 30"
> >> - log: "${body}"
> >>
> >> - route:
> >> id: secondRoute
> >> from:
> >> uri: "timer:yaml"
> >> parameters:
> >> period: "3000"
> >> steps:
> >> - setBody:
> >> constant: "Hello Camel from yaml timer this one"
> >> - log: "${body}"
> >>
> >> When I run the routes I can see the ids:
> >>
> >> 2022-12-26 11:28:42.504  INFO 79551 --- [   main]
> >> e.camel.impl.engine.AbstractCamelContext : Started firstRoute
> >> (timer://yaml)
> >> 2022-12-26 11:28:42.504  INFO 79551 --- [   main]
> >> e.camel.impl.engine.AbstractCamelContext : Started secondRoute
> >> (timer://yaml)
> >>
> >> Then I've enabled live reload using application.properties with
> >> camel.main.routes-reload-remove-all-routes set to false. Here's the
> >> full application.properties:
> >>
> >> # routes to load
> >> camel.main.routes-reload-enabled = true
> >> camel.main.routes-reload-directory = file:./
> >> camel.main.routes-reload-pattern = *.yaml
> >> camel.main.routes-reload-remove-all-routes = false
> >>
> >> Now when I use Camel Jbang to run the routes:
> >>
> >> camel run timers.yaml
> >>
> >> I can see the route ids and the mention that live reload is enabled:
> >>
> >> 2022-12-26 11:32:03.051  INFO 79751 --- [   main]
> >> upport.FileWatcherResourceReloadStrategy : Live route reloading
> >> enabled (directory: .)
> >> 2022-12-26 11:32:03.073  INFO 79751 --- [   main]
> >> e.camel.impl.engine.AbstractCamelContext : Routes startup (started:2)
> >> 2022-12-26 11:32:03.073  INFO 79751 --- [   main]
> >> e.camel.impl.engine.AbstractCamelContext : Started firstRoute
> >> (timer://yaml)
> >> 2022-12-26 11:32:03.073  INFO 79751 --- [   main]
> >> e.camel.impl.engine.AbstractCamelContext : Started secondRoute
> >> (timer://yaml)
> >>
> >> But when I modify one of the routes in the timers.yaml, I get an
> >> warning about missing ids:
> >>
> >> 2022-12-26 11:33:48.522  INFO 79845 --- [rReloadStrategy]
> >> e.camel.impl.engine.AbstractCamelContext : Stopped firstRoute
> >> (timer://yaml)
> >> 2022-12-26 11:33:48.523  INFO 79845 --- [rReloadStrategy]
> >> e.camel.impl.engine.AbstractCamelContext : Shutdown firstRoute
> >> (timer://yaml)
> >> 2022-12-26 11:33:48.524  INFO 79845 --- [rReloadStrat

Camel JBang 3.20: camel.support.RouteWatcherReloadStrategy : Routes with no id's detected...

2022-12-26 Thread Mikael Koskinen
Hi,

I'm testing how the route reload works if one file has multiple
routes. I've defined two routes in a single file and assigned ids to
both:

- route:
id: firstRoute
from:
uri: "timer:yaml"
parameters:
period: "2000"
steps:
- setBody:
constant: "Hello Camel from yaml timer 30"
- log: "${body}"

- route:
id: secondRoute
from:
uri: "timer:yaml"
parameters:
period: "3000"
steps:
- setBody:
constant: "Hello Camel from yaml timer this one"
- log: "${body}"

When I run the routes I can see the ids:

2022-12-26 11:28:42.504  INFO 79551 --- [   main]
e.camel.impl.engine.AbstractCamelContext : Started firstRoute
(timer://yaml)
2022-12-26 11:28:42.504  INFO 79551 --- [   main]
e.camel.impl.engine.AbstractCamelContext : Started secondRoute
(timer://yaml)

Then I've enabled live reload using application.properties with
camel.main.routes-reload-remove-all-routes set to false. Here's the
full application.properties:

# routes to load
camel.main.routes-reload-enabled = true
camel.main.routes-reload-directory = file:./
camel.main.routes-reload-pattern = *.yaml
camel.main.routes-reload-remove-all-routes = false

Now when I use Camel Jbang to run the routes:

camel run timers.yaml

I can see the route ids and the mention that live reload is enabled:

2022-12-26 11:32:03.051  INFO 79751 --- [   main]
upport.FileWatcherResourceReloadStrategy : Live route reloading
enabled (directory: .)
2022-12-26 11:32:03.073  INFO 79751 --- [   main]
e.camel.impl.engine.AbstractCamelContext : Routes startup (started:2)
2022-12-26 11:32:03.073  INFO 79751 --- [   main]
e.camel.impl.engine.AbstractCamelContext : Started firstRoute
(timer://yaml)
2022-12-26 11:32:03.073  INFO 79751 --- [   main]
e.camel.impl.engine.AbstractCamelContext : Started secondRoute
(timer://yaml)

But when I modify one of the routes in the timers.yaml, I get an
warning about missing ids:

2022-12-26 11:33:48.522  INFO 79845 --- [rReloadStrategy]
e.camel.impl.engine.AbstractCamelContext : Stopped firstRoute
(timer://yaml)
2022-12-26 11:33:48.523  INFO 79845 --- [rReloadStrategy]
e.camel.impl.engine.AbstractCamelContext : Shutdown firstRoute
(timer://yaml)
2022-12-26 11:33:48.524  INFO 79845 --- [rReloadStrategy]
e.camel.impl.engine.AbstractCamelContext : Stopped secondRoute
(timer://yaml)
2022-12-26 11:33:48.524  INFO 79845 --- [rReloadStrategy]
e.camel.impl.engine.AbstractCamelContext : Shutdown secondRoute
(timer://yaml)
2022-12-26 11:33:48.537  INFO 79845 --- [rReloadStrategy]
camel.support.RouteWatcherReloadStrategy : Routes reloaded summary
(total:2 started:2)
2022-12-26 11:33:48.537  INFO 79845 --- [rReloadStrategy]
camel.support.RouteWatcherReloadStrategy : Started firstRoute
(timer://yaml) (source: timers.yaml:4)
2022-12-26 11:33:48.537  INFO 79845 --- [rReloadStrategy]
camel.support.RouteWatcherReloadStrategy : Started secondRoute
(timer://yaml) (source: timers.yaml:15)
2022-12-26 11:33:48.538  WARN 79845 --- [rReloadStrategy]
camel.support.RouteWatcherReloadStrategy : Routes with no id's
detected. Its recommended to assign route id's to your routes so Camel
can reload the routes correctly.
Unassigned routes:
timer://yaml?period=2000
timer://yaml?period=3000

A bug?

Best regards,
Mikael


Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-12-02 Thread Mikael Koskinen
Hi,

I'm happy to report that it is now working! I first tested with
Windows Sandbox (a fresh Windows 10 image) and then with my main
Windows where I had previously tested it and both worked like a charm.
I didn't have to delete the m2 repo.

Here's the dependency list which the latest version generated:



org.apache.camel.quarkus
camel-quarkus-core


org.apache.camel.quarkus
camel-quarkus-platform-http


org.apache.camel.quarkus
camel-quarkus-microprofile-health


org.apache.camel.quarkus
camel-quarkus-file-watch


org.apache.camel.quarkus
camel-quarkus-http


org.apache.camel.quarkus
camel-quarkus-kamelet


org.apache.camel.quarkus
camel-quarkus-rest


org.apache.camel.quarkus
camel-quarkus-yaml-dsl


org.apache.camel.kamelets
camel-kamelets-utils
0.9.3


org.apache.camel
*




org.apache.camel.kamelets
camel-kamelets
0.9.3




io.quarkus
quarkus-junit5
test



Thank you for all the help!

pe 2. jouluk. 2022 klo 8.53 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> Oh it also looks like the CI job did not complete last day, so wait for
> this build to succeed
> https://ci-builds.apache.org/job/Camel/job/Camel%20Daily%20Snapshot%20Deploy/job/main/154/
>
> On Fri, Dec 2, 2022 at 7:51 AM Claus Ibsen  wrote:
>
> > Hi
> >
> > You can try to delete from your local m2 repo
> > io/quarkus/platform/quarkus-camel-bom
> >
> > And then try again, as this BOM is what we need to be able to download,
> > and load to resolve correct dependencies for the generated pom.xml.
> >
> >
> >
> >
> > On Thu, Dec 1, 2022 at 6:10 PM Mikael Koskinen  wrote:
> >
> >> Hey,
> >>
> >> I was now able to test things using the latest 3.20.0-SNAPSHOT in
> >> Windows 10 but unfortunately the issue seems to persist.
> >>
> >> I started from a new clean folder and then issued:
> >>
> >> jbang run --fresh "-Dcamel.jbang.version=3.20.0-SNAPSHOT"
> >> camel@apache/camel export --runtime=
> >> quarkus --gav=com.foo:acme:1.0-SNAPSHOT -dir=pub
> >> --quarkus-version=2.14.2.Final
> >>
> >> There's couple new dependencies, but unfortunately the pom.xml still
> >> isn't using quarkus everywhere:
> >>
> >> ---
> >>
> >> 
> >> 
> >> org.apache.camel.quarkus
> >> camel-quarkus-core
> >> 
> >> 
> >> org.apache.camel.quarkus
> >> camel-quarkus-platform-http
> >> 
> >> 
> >> org.apache.camel.quarkus
> >> camel-quarkus-microprofile-health
> >> 
> >> 
> >> org.apache.camel
> >> camel-file-watch
> >> 3.20.0-SNAPSHOT
> >> 
> >> 
> >> org.apache.camel
> >> camel-http
> >> 3.20.0-SNAPSHOT
> >> 
> >> 
> >> org.apache.camel
> >> camel-kamelet
> >> 3.20.0-SNAPSHOT
> >> 
> >> 
> >> org.apache.camel
> >> camel-rest
> >> 3.20.0-SNAPSHOT
> >> 
> >> 
> >> org.apache.camel
> >> camel-yaml-dsl
> >> 3.20.0-SNAPSHOT
> >> 
> >> 
> >> org.apache.camel.kamelets
> >> camel-kamelets-utils
> >> 0.9.3
> >> 
> >> 
> >> org.apache.camel
> >> *
> >> 
> >> 
> >> 
> >> 
> >> org.apache.camel.kamelets
> >> camel-kamelets
> >>     0.9.3
> >> 
> >>
> >>
> >> 
> >> io.quarkus
> >> quarkus-junit5
> >> tes

Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-12-01 Thread Mikael Koskinen
Hey,

I was now able to test things using the latest 3.20.0-SNAPSHOT in
Windows 10 but unfortunately the issue seems to persist.

I started from a new clean folder and then issued:

jbang run --fresh "-Dcamel.jbang.version=3.20.0-SNAPSHOT"
camel@apache/camel export --runtime=
quarkus --gav=com.foo:acme:1.0-SNAPSHOT -dir=pub --quarkus-version=2.14.2.Final

There's couple new dependencies, but unfortunately the pom.xml still
isn't using quarkus everywhere:

---



org.apache.camel.quarkus
camel-quarkus-core


org.apache.camel.quarkus
camel-quarkus-platform-http


org.apache.camel.quarkus
camel-quarkus-microprofile-health


org.apache.camel
camel-file-watch
3.20.0-SNAPSHOT


org.apache.camel
camel-http
3.20.0-SNAPSHOT


org.apache.camel
camel-kamelet
3.20.0-SNAPSHOT


org.apache.camel
camel-rest
3.20.0-SNAPSHOT


org.apache.camel
camel-yaml-dsl
3.20.0-SNAPSHOT


org.apache.camel.kamelets
camel-kamelets-utils
0.9.3


org.apache.camel
*




org.apache.camel.kamelets
camel-kamelets
0.9.3




io.quarkus
quarkus-junit5
test



---

Diffing this vs the previous version I see that these are new
dependencies which weren't added previously:

camel-kamelet
camel-kamelets-utils
camel-kamelets

When I previously manually modified the pom.xml to make things work I
had to add the following two which aren't included in the newly
generated pom.xml:

camel-quarkus-kamelet
camel-kamelets-catalog

I'm not sure what's the difference between camel-kamelets and
camel-kamelets-catalog.

ke 30. marrask. 2022 klo 20.21 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Hi,
>
> Thanks! I'll try the SNAPSHOT tomorrow and report back on how it works.
>
> ke 30. marrask. 2022 klo 15.05 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
> >
> > Hi
> >
> > Okay I have a potential fix.
> >
> > You can test this by building from source (or wait till tomorrow for CI
> > server to publish a new SNAPSHOT)
> > For source you only need to build dsl/camel-jbang
> >
> > So checkout the camel source code ( a lot of source )
> > cd dsl/camel-jbang
> > mvn clean install
> >
> > and then try again on windows
> >
> > On Wed, Nov 30, 2022 at 1:55 PM Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > Yeah I think its a windows bug in camel-jbang, we had to download
> > > camel-quarkus-catalog in a special way with the Shrinkwrap project.
> > > However now we use standard Maven so we can likely downloader this in a
> > > better way that can work for windows too
> > > https://issues.apache.org/jira/browse/CAMEL-18778
> > >
> > > On Wed, Nov 30, 2022 at 1:48 PM Mikael Koskinen 
> > > wrote:
> > >
> > >> Hey,
> > >>
> > >> I tested with Mac and it worked from the get go with 3.20.0-SNAPSHOT:
> > >> all the dependencies are quarkus versions as expected.
> > >>
> > >> Haven't been able to test the Spring boot & Windows combination yet.
> > >>
> > >> ke 30. marrask. 2022 klo 11.25 Mikael Koskinen (mijap...@gmail.com)
> > >> kirjoitti:
> > >> >
> > >> > Hi,
> > >> >
> > >> > Yep, using Windows. I’ll try the Spring boot export & running things
> > >> with Mac later today and report back with my findings.
> > >> >
> > >> > On Wednesday, November 30, 2022, Claus Ibsen 
> > >> wrote:
> > >> >>
> > >> >> Hi
> > >> >>
> > >> >> Are you using windows btw? I suspect it may also be related to that,
> > >> as it
> > >> >> smells like the camel-quarkus-catalog (needed for export to Q)
> > >> >> is not downloaded and resolved correctly so we fallback to core camel
> > >> maven
> > >> >> GAVs
> > >> >>
> > >> >> Can you try to export to spring boot and look in the generated pom.xml
> > >> that
> > >> >> the GAVs are using camel-xxx-starter ?
> > >> >>
> > >&g

Re: YAML DSL/Karavan: HTTPS request to server which has self-signed certificate/invalid certificate

2022-12-01 Thread Mikael Koskinen
Hi,

Thanks, sounds good!

Regarding the kamelets and http. I tested/used them earlier today when
trying to remove some duplication and making a YAML route more
readable. I think creating a custom kamelet worked nicely in hiding
the nitty gritty details from the actual route.

I'm testing different ways of using Camel in reverse proxy scenarios
with an idea that maybe we could at some point replace our current
Ocelot Proxy based solution with a Camel based one. This way we could
use Camel's components to add customization options to the downstream
requests/responses.

I'm not sure if I could have hidden the repetitive code some other
way, but I used a custom kamelet sink to do the http calls. Here's how
its template ended up looking:

  template:
from:
  uri: kamelet:source
  steps:
- to:
uri: "{{url}}"
parameters:
  bridgeEndpoint: true
  throwExceptionOnFailure: false
  preserveHostHeader: true
  copyHeaders: false
  responsePayloadStreamingThreshold: -1
  disableStreamCache: true

This allowed to keep the load balanced proxy route IMHO quite easy to
understand and to maintain:

- route:
from:
  uri: netty-http:http://0.0.0.0:8181/api
  steps:
- loadBalance:
failover:
  roundRobin: true
steps:
  - to:
  uri: "kamelet:http-proxy-sink"
  parameters:
url:
https://webhook.site/997c59f4-430b-451f-9b79-fe0f4a2464d3
  - to:
  uri: "kamelet:http-proxy-sink"
  parameters:
url:
https://webhook.site/5f36b5e0-4f27-4439-b15b-5af4b06db66f
  parameters:
matchOnUriPrefix: true
httpMethodRestrict: GET

Still not sure if this is the optimal way of doing things as there's
much to learn and to test.

to 1. jouluk. 2022 klo 15.53 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> Yeah making using camel components easier for quickly trying out and
> testing stuff is excellent with karavan / jbang and kamelets.
>
> Have you looked the kamelets for http? We can liketry make a
> derivation that can do HTTPS - In the past there was some dummy http
> certificate trust manager (of some sorts),
> that could be = true.
>
> We can maybe find that old code, and put it into a new kamelet.
>
>
>
> On Thu, Dec 1, 2022 at 7:15 AM Mikael Koskinen  wrote:
>
> > Hi,
> >
> > I'm wondering if it possible to use just YAML DSL/Karavan to create a
> > route where HTTP/Netty-http/Undertow component makes a HTTPS request
> > to server where server has either:
> >
> > a) Self-signed but otherwise valid certificate
> > b) Expired or otherwise invalid certificate
> >
> > I was kind of hoping to find something like
> > disableRemoteCertificateValidation which could be checked through
> > Karavan. Couldn't find one and tried to find a solution using just the
> > YAML DSL and failed again.
> >
> > In my case the self-signed certificates are the issue and they change
> > a lot and so just enabling some "I know this is wrong but just make
> > this work" property would be a life saver instead of having to mess
> > with keys etc.
> >
> > Is there a "pure YAML DSL" way of making a https request to a server
> > presenting a self-signed certificate?
> >
> > Thanks in advance for any guidance.
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


YAML DSL/Karavan: HTTPS request to server which has self-signed certificate/invalid certificate

2022-11-30 Thread Mikael Koskinen
Hi,

I'm wondering if it possible to use just YAML DSL/Karavan to create a
route where HTTP/Netty-http/Undertow component makes a HTTPS request
to server where server has either:

a) Self-signed but otherwise valid certificate
b) Expired or otherwise invalid certificate

I was kind of hoping to find something like
disableRemoteCertificateValidation which could be checked through
Karavan. Couldn't find one and tried to find a solution using just the
YAML DSL and failed again.

In my case the self-signed certificates are the issue and they change
a lot and so just enabling some "I know this is wrong but just make
this work" property would be a life saver instead of having to mess
with keys etc.

Is there a "pure YAML DSL" way of making a https request to a server
presenting a self-signed certificate?

Thanks in advance for any guidance.


Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-11-30 Thread Mikael Koskinen
Hi,

Thanks! I'll try the SNAPSHOT tomorrow and report back on how it works.

ke 30. marrask. 2022 klo 15.05 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> Okay I have a potential fix.
>
> You can test this by building from source (or wait till tomorrow for CI
> server to publish a new SNAPSHOT)
> For source you only need to build dsl/camel-jbang
>
> So checkout the camel source code ( a lot of source )
> cd dsl/camel-jbang
> mvn clean install
>
> and then try again on windows
>
> On Wed, Nov 30, 2022 at 1:55 PM Claus Ibsen  wrote:
>
> > Hi
> >
> > Yeah I think its a windows bug in camel-jbang, we had to download
> > camel-quarkus-catalog in a special way with the Shrinkwrap project.
> > However now we use standard Maven so we can likely downloader this in a
> > better way that can work for windows too
> > https://issues.apache.org/jira/browse/CAMEL-18778
> >
> > On Wed, Nov 30, 2022 at 1:48 PM Mikael Koskinen 
> > wrote:
> >
> >> Hey,
> >>
> >> I tested with Mac and it worked from the get go with 3.20.0-SNAPSHOT:
> >> all the dependencies are quarkus versions as expected.
> >>
> >> Haven't been able to test the Spring boot & Windows combination yet.
> >>
> >> ke 30. marrask. 2022 klo 11.25 Mikael Koskinen (mijap...@gmail.com)
> >> kirjoitti:
> >> >
> >> > Hi,
> >> >
> >> > Yep, using Windows. I’ll try the Spring boot export & running things
> >> with Mac later today and report back with my findings.
> >> >
> >> > On Wednesday, November 30, 2022, Claus Ibsen 
> >> wrote:
> >> >>
> >> >> Hi
> >> >>
> >> >> Are you using windows btw? I suspect it may also be related to that,
> >> as it
> >> >> smells like the camel-quarkus-catalog (needed for export to Q)
> >> >> is not downloaded and resolved correctly so we fallback to core camel
> >> maven
> >> >> GAVs
> >> >>
> >> >> Can you try to export to spring boot and look in the generated pom.xml
> >> that
> >> >> the GAVs are using camel-xxx-starter ?
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> On Tue, Nov 29, 2022 at 8:12 PM Mikael Koskinen 
> >> wrote:
> >> >>
> >> >> > Hey,
> >> >> >
> >> >> > Thank you for the help here and in the Gist.
> >> >> >
> >> >> > Based on the suggestions I tested the JBang version 3.20.0-SNAPSHOT
> >> >> > and with Quarkus 2.14.2.Final and still encountered the same issue.
> >> >> >
> >> >> > Manually modifying the exported pom.xml got things working. I updated
> >> >> > the gist with logs and also with the changes I did to pom.xml to make
> >> >> > things work.
> >> >> >
> >> >> > ti 29. marrask. 2022 klo 8.21 Claus Ibsen (claus.ib...@gmail.com)
> >> >> > kirjoitti:
> >> >> > >
> >> >> > > Hi
> >> >> > >
> >> >> > > I created a ticket at CEQ
> >> >> > > https://github.com/apache/camel-quarkus/issues/4300
> >> >> > >
> >> >> > > What camel-quarkus version are you using btw. You can try with
> >> latest
> >> >> > > 2.14.2 release, you can re-export and set the quarkus version with
> >> the
> >> >> > > --quarkus-version option, or adjust the existing pom.xml
> >> >> > >
> >> >> > > On Tue, Nov 29, 2022 at 7:10 AM Claus Ibsen  >> >
> >> >> > wrote:
> >> >> > >
> >> >> > > > Hi
> >> >> > > >
> >> >> > > > Yeah it suspect quarkus http extension does not bring in servlet
> >> api
> >> >> > JAR
> >> >> > > > which is needed by camel-http.
> >> >> > > >
> >> >> >
> >> https://github.com/apache/camel/blob/main/components/camel-http/pom.xml#L55
> >> >> > > >
> >> >> > > > You can when doing export try adding
> >> >> > > > --deps=javax.servlet:javax.servlet-api:3.1.0 (or whatever maven
> >> JAR
> >> >> > that
> >> >&g

Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-11-30 Thread Mikael Koskinen
Hey,

I tested with Mac and it worked from the get go with 3.20.0-SNAPSHOT:
all the dependencies are quarkus versions as expected.

Haven't been able to test the Spring boot & Windows combination yet.

ke 30. marrask. 2022 klo 11.25 Mikael Koskinen (mijap...@gmail.com) kirjoitti:
>
> Hi,
>
> Yep, using Windows. I’ll try the Spring boot export & running things with Mac 
> later today and report back with my findings.
>
> On Wednesday, November 30, 2022, Claus Ibsen  wrote:
>>
>> Hi
>>
>> Are you using windows btw? I suspect it may also be related to that, as it
>> smells like the camel-quarkus-catalog (needed for export to Q)
>> is not downloaded and resolved correctly so we fallback to core camel maven
>> GAVs
>>
>> Can you try to export to spring boot and look in the generated pom.xml that
>> the GAVs are using camel-xxx-starter ?
>>
>>
>>
>>
>> On Tue, Nov 29, 2022 at 8:12 PM Mikael Koskinen  wrote:
>>
>> > Hey,
>> >
>> > Thank you for the help here and in the Gist.
>> >
>> > Based on the suggestions I tested the JBang version 3.20.0-SNAPSHOT
>> > and with Quarkus 2.14.2.Final and still encountered the same issue.
>> >
>> > Manually modifying the exported pom.xml got things working. I updated
>> > the gist with logs and also with the changes I did to pom.xml to make
>> > things work.
>> >
>> > ti 29. marrask. 2022 klo 8.21 Claus Ibsen (claus.ib...@gmail.com)
>> > kirjoitti:
>> > >
>> > > Hi
>> > >
>> > > I created a ticket at CEQ
>> > > https://github.com/apache/camel-quarkus/issues/4300
>> > >
>> > > What camel-quarkus version are you using btw. You can try with latest
>> > > 2.14.2 release, you can re-export and set the quarkus version with the
>> > > --quarkus-version option, or adjust the existing pom.xml
>> > >
>> > > On Tue, Nov 29, 2022 at 7:10 AM Claus Ibsen 
>> > wrote:
>> > >
>> > > > Hi
>> > > >
>> > > > Yeah it suspect quarkus http extension does not bring in servlet api
>> > JAR
>> > > > which is needed by camel-http.
>> > > >
>> > https://github.com/apache/camel/blob/main/components/camel-http/pom.xml#L55
>> > > >
>> > > > You can when doing export try adding
>> > > > --deps=javax.servlet:javax.servlet-api:3.1.0 (or whatever maven JAR
>> > that
>> > > > quarkus uses for servlet as there are many of them)
>> > > >
>> > > > On Fri, Nov 25, 2022 at 8:30 PM Mikael Koskinen 
>> > > > wrote:
>> > > >
>> > > >> Hi,
>> > > >>
>> > > >> I have some issues when trying to export an integration to Quarkus
>> > > >> runtime using Camel JBang if the integration uses
>> > > >> kamelet:http-sink.The sample integration causing issues is available
>> > > >> from here:
>> > > >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
>> > > >>
>> > > >> The integration runs fine using "camel run myintegration.yaml"
>> > > >>
>> > > >> But if I export it to Quarkus using "camel export -dir=pub
>> > > >> --gav=com.foo:acme:1.0-SNAPSHOT --runtime=quarkus --fresh"
>> > > >>
>> > > >> And then try to run things using "mvn compile quarkus:dev" I get:
>> > > >>
>> > > >> ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error
>> > > >> running Quarkus: java.lang.reflect.InvocationTargetException
>> > > >> ...
>> > > >> Caused by: java.lang.ClassNotFoundException:
>> > > >> javax.servlet.http.HttpServletRequest
>> > > >> at
>> > > >>
>> > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
>> > > >> at
>> > > >>
>> > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>> > > >> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>> > > >> at
>> > > >>
>> > io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:490)
>> > > >> at
>> > > >>
>> > io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:440)
>> > > >>
>> > > >> The full exception is available from the same gist:
>> > > >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
>> > > >>
>> > > >> If I export to Camel Main it works OK.
>> > > >>
>> > > >> Am I missing something? Any advice is appreciated.
>> > > >>
>> > > >
>> > > >
>> > > > --
>> > > > Claus Ibsen
>> > > > -
>> > > > @davsclaus
>> > > > Camel in Action 2: https://www.manning.com/ibsen2
>> > > >
>> > >
>> > >
>> > > --
>> > > Claus Ibsen
>> > > -
>> > > @davsclaus
>> > > Camel in Action 2: https://www.manning.com/ibsen2
>> >
>>
>>
>> --
>> Claus Ibsen
>> -
>> @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-11-30 Thread Mikael Koskinen
Hi,

Yep, using Windows. I’ll try the Spring boot export & running things with
Mac later today and report back with my findings.

On Wednesday, November 30, 2022, Claus Ibsen  wrote:

> Hi
>
> Are you using windows btw? I suspect it may also be related to that, as it
> smells like the camel-quarkus-catalog (needed for export to Q)
> is not downloaded and resolved correctly so we fallback to core camel maven
> GAVs
>
> Can you try to export to spring boot and look in the generated pom.xml that
> the GAVs are using camel-xxx-starter ?
>
>
>
>
> On Tue, Nov 29, 2022 at 8:12 PM Mikael Koskinen 
> wrote:
>
> > Hey,
> >
> > Thank you for the help here and in the Gist.
> >
> > Based on the suggestions I tested the JBang version 3.20.0-SNAPSHOT
> > and with Quarkus 2.14.2.Final and still encountered the same issue.
> >
> > Manually modifying the exported pom.xml got things working. I updated
> > the gist with logs and also with the changes I did to pom.xml to make
> > things work.
> >
> > ti 29. marrask. 2022 klo 8.21 Claus Ibsen (claus.ib...@gmail.com)
> > kirjoitti:
> > >
> > > Hi
> > >
> > > I created a ticket at CEQ
> > > https://github.com/apache/camel-quarkus/issues/4300
> > >
> > > What camel-quarkus version are you using btw. You can try with latest
> > > 2.14.2 release, you can re-export and set the quarkus version with the
> > > --quarkus-version option, or adjust the existing pom.xml
> > >
> > > On Tue, Nov 29, 2022 at 7:10 AM Claus Ibsen 
> > wrote:
> > >
> > > > Hi
> > > >
> > > > Yeah it suspect quarkus http extension does not bring in servlet api
> > JAR
> > > > which is needed by camel-http.
> > > >
> > https://github.com/apache/camel/blob/main/components/
> camel-http/pom.xml#L55
> > > >
> > > > You can when doing export try adding
> > > > --deps=javax.servlet:javax.servlet-api:3.1.0 (or whatever maven JAR
> > that
> > > > quarkus uses for servlet as there are many of them)
> > > >
> > > > On Fri, Nov 25, 2022 at 8:30 PM Mikael Koskinen 
> > > > wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> I have some issues when trying to export an integration to Quarkus
> > > >> runtime using Camel JBang if the integration uses
> > > >> kamelet:http-sink.The sample integration causing issues is available
> > > >> from here:
> > > >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
> > > >>
> > > >> The integration runs fine using "camel run myintegration.yaml"
> > > >>
> > > >> But if I export it to Quarkus using "camel export -dir=pub
> > > >> --gav=com.foo:acme:1.0-SNAPSHOT --runtime=quarkus --fresh"
> > > >>
> > > >> And then try to run things using "mvn compile quarkus:dev" I get:
> > > >>
> > > >> ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread)
> Error
> > > >> running Quarkus: java.lang.reflect.InvocationTargetException
> > > >> ...
> > > >> Caused by: java.lang.ClassNotFoundException:
> > > >> javax.servlet.http.HttpServletRequest
> > > >> at
> > > >>
> > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
> BuiltinClassLoader.java:581)
> > > >> at
> > > >>
> > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.
> loadClass(ClassLoaders.java:178)
> > > >> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
> > > >> at
> > > >>
> > io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(
> QuarkusClassLoader.java:490)
> > > >> at
> > > >>
> > io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(
> QuarkusClassLoader.java:440)
> > > >>
> > > >> The full exception is available from the same gist:
> > > >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
> > > >>
> > > >> If I export to Camel Main it works OK.
> > > >>
> > > >> Am I missing something? Any advice is appreciated.
> > > >>
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -
> > > > @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-11-29 Thread Mikael Koskinen
Hey,

Thank you for the help here and in the Gist.

Based on the suggestions I tested the JBang version 3.20.0-SNAPSHOT
and with Quarkus 2.14.2.Final and still encountered the same issue.

Manually modifying the exported pom.xml got things working. I updated
the gist with logs and also with the changes I did to pom.xml to make
things work.

ti 29. marrask. 2022 klo 8.21 Claus Ibsen (claus.ib...@gmail.com) kirjoitti:
>
> Hi
>
> I created a ticket at CEQ
> https://github.com/apache/camel-quarkus/issues/4300
>
> What camel-quarkus version are you using btw. You can try with latest
> 2.14.2 release, you can re-export and set the quarkus version with the
> --quarkus-version option, or adjust the existing pom.xml
>
> On Tue, Nov 29, 2022 at 7:10 AM Claus Ibsen  wrote:
>
> > Hi
> >
> > Yeah it suspect quarkus http extension does not bring in servlet api JAR
> > which is needed by camel-http.
> > https://github.com/apache/camel/blob/main/components/camel-http/pom.xml#L55
> >
> > You can when doing export try adding
> > --deps=javax.servlet:javax.servlet-api:3.1.0 (or whatever maven JAR that
> > quarkus uses for servlet as there are many of them)
> >
> > On Fri, Nov 25, 2022 at 8:30 PM Mikael Koskinen 
> > wrote:
> >
> >> Hi,
> >>
> >> I have some issues when trying to export an integration to Quarkus
> >> runtime using Camel JBang if the integration uses
> >> kamelet:http-sink.The sample integration causing issues is available
> >> from here:
> >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
> >>
> >> The integration runs fine using "camel run myintegration.yaml"
> >>
> >> But if I export it to Quarkus using "camel export -dir=pub
> >> --gav=com.foo:acme:1.0-SNAPSHOT --runtime=quarkus --fresh"
> >>
> >> And then try to run things using "mvn compile quarkus:dev" I get:
> >>
> >> ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error
> >> running Quarkus: java.lang.reflect.InvocationTargetException
> >> ...
> >> Caused by: java.lang.ClassNotFoundException:
> >> javax.servlet.http.HttpServletRequest
> >> at
> >> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
> >> at
> >> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
> >> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
> >> at
> >> io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:490)
> >> at
> >> io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:440)
> >>
> >> The full exception is available from the same gist:
> >> https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec
> >>
> >> If I export to Camel Main it works OK.
> >>
> >> Am I missing something? Any advice is appreciated.
> >>
> >
> >
> > --
> > Claus Ibsen
> > -
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Camel JBang http-sink issue when exporting to Quarkus runtime: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest

2022-11-25 Thread Mikael Koskinen
Hi,

I have some issues when trying to export an integration to Quarkus
runtime using Camel JBang if the integration uses
kamelet:http-sink.The sample integration causing issues is available
from here: https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec

The integration runs fine using "camel run myintegration.yaml"

But if I export it to Quarkus using "camel export -dir=pub
--gav=com.foo:acme:1.0-SNAPSHOT --runtime=quarkus --fresh"

And then try to run things using "mvn compile quarkus:dev" I get:

ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error
running Quarkus: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.ClassNotFoundException:
javax.servlet.http.HttpServletRequest
at 
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at 
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at 
io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:490)
at 
io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:440)

The full exception is available from the same gist:
https://gist.github.com/mikoskinen/71ce1d1ba5b5d7b690a4ec12af20e8ec

If I export to Camel Main it works OK.

Am I missing something? Any advice is appreciated.