Manage health checks at runtime

2022-03-28 Thread Benjamin Graf

Hi,

does anybody know a way to enable/disable route/consumer checks for 
specific items at runtime. As I can see it's only possible to 
enable/disable the complete repository itself and the HealthCheck once 
computed seems not reconfigurable any more.


Maybe worth for an enhancement?

Regards

Benjamin



OpenPGP_signature
Description: OpenPGP digital signature


Re: CamelSqlGeneratedKeyRows is not updated

2022-03-28 Thread Jeremy Ross
This is a regression. I filed an issue
https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-17866.

On Fri, Mar 25, 2022 at 1:20 PM Karen Lease  wrote:

> Hi,
>
> There was a similar issue a while back (CAMEL-16761). In that case, the
> issue occurred in a loop but I think the root cause is the same.
> The solution suggested by Jeremy should work; you need to insert
> .removeHeader("CamelSqlGeneratedKeyRows")
> before your second ".to("sql:INSERT...").
>
> Regards,
> Karen
>
>
> On 24/03/2022 20:07, Jeremy Ross wrote:
> > To clarify, I'm recommending *clearing* the CamelSqlGeneratedKeyRows
> header
> > prior to the sql call.
> >
> > On Wed, Mar 23, 2022 at 9:34 PM Reto Peter 
> wrote:
> >
> >> Hi
> >>
> >> I tried both with no success
> >> a) it works as normal, I get the keys back if I only run the 2nd select
> >> b) I set the Header before first statement and before second statement
> but
> >> no change.
> >>
> >> -Original Message-
> >> From: Claus Ibsen 
> >> Sent: Thursday, March 24, 2022 3:51 AM
> >> To: users@camel.apache.org
> >> Subject: Re: CamelSqlGeneratedKeyRows is not updated
> >>
> >> Hi
> >>
> >> a)
> >> Can you try with just 1 sql insert,
> >> .to("sql:INSERT INTO message_out(identifier) VALUES (1)")
> >>
> >> It may be that this SQL does not return any generated keys
> >>
> >>
> >> b)
> >> Can you try to set the header to get keys before calling the 2nd insert
> >>   .setHeader("CamelSqlRetrieveGeneratedKeys").simple("true")
> >>
> >> On Wed, Mar 23, 2022 at 9:59 AM Reto Peter 
> >> wrote:
> >>>
> >>> Hi
> >>>
> >>> I have a route with 2 following SQL INSERT commands.
> >>> One inserts into table A (CamelSqlGeneratedKeyRows is correct) Next
> >>> inserts into table B (CamelSqlGeneratedKeyRows is wrong, the value is
> >>> not updated, it remains the same)
> >>>
> >>> I am using mySQL and Java 11
> >>>
> >>> My simplified route:
> >>>
> >>
> from("file:{{dir.from.flowline.test}}?preMove=.inprogress=.done=1000")
> >>>  .tracing()
> >>>  .log("Processing file: ${file:name}")
> >>>  .convertBodyTo(String.class)
> >>>
> >>   .setHeader("CamelSqlRetrieveGeneratedKeys").simple("true")
> >>>  .to("sql:INSERT INTO files_from_partner(filename,
> >> filecontent, partner_id) VALUES (:#${file:name},:#${body}, 1)")
> >>>  .log("${headers.CamelSqlGeneratedKeyRows}")
> >>>  .to("sql:INSERT INTO message_out(identifier)
> VALUES
> >> (1)")
> >>>  .log("${headers.CamelSqlGeneratedKeyRows}");
> >>>
> >>> Output when I process 1 files is:
> >>> Processing file: GDELR_1848540_BL-V2100029_55234 use it 4 TESTS II.xml
> >>> [{GENERATED_KEY=58}] correct [{GENERATED_KEY=58}] wrong
> >>>
> >>> Do I do something wrong, is it a bug?
> >>> I also tried to set the Header CamelSqlGeneratedColumns as follows:
> >>> @Component
> >>> class SetFilesFromPartnerKeyColumnsBean {
> >>> public void setKeys(String message, @Headers Map Object>
> >> outHeaders) {
> >>>   outHeaders.put("CamelSqlGeneratedColumns", new String[]
> >> {"files_id"});
> >>> }
> >>> } And before executing the SQL INSERT in the route:
> >>> .bean(setFilesFromPartnerKeyColumnsBean)
> >>> But there was no effect, same results
> >>>
> >>> MY workaround is with the "SELECT LAST_INSERT_ID()" which works but of
> >> course not the way we should ...
> >>>
> >>> Regards Reto
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -
> >> http://davsclaus.com @davsclaus
> >> Camel in Action 2: https://www.manning.com/ibsen2
> >>
> >
>


[ANNOUNCE] Apache Camel 3.16.0 Released

2022-03-28 Thread Gregor Zurowski
The Camel PMC is pleased to announce the release of Apache Camel 3.16.0.

Apache Camel is an open source integration framework that empowers you
to quickly and easily integrate various systems consuming or producing
data.

This release is a new minor release and contains 206 bug fixes and improvements.

The release is available for immediate download at:

https://camel.apache.org/download/

For more details please take a look at the release notes at:

https://camel.apache.org/releases/release-3.16.0/


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Claus Ibsen
It is a plugin to assist when building custom camel components, not to
use for end user applications.

It is currently two-step as I said. Its not an easy fix.

In the camel project we have a re-compile step


maven-compiler-plugin


recompile

compile

process-classes





On Mon, Mar 28, 2022 at 1:39 PM Minh Tran  wrote:
>
> Are you suggesting we should really be executing the build like this?
>
> mvn clean process-classes test
>
> It works I guess but highly unconventional compared to other maven code
> generation plugins. It could also potentially be a big overhead as you're
> running the all the phases prior to process-classes twice.
>
> Wouldn't the simplest solution be to fix the plugin to allow generating the
> source during the generate-sources phase?
>
> On Mon, 28 Mar 2022 at 21:42, Claus Ibsen  wrote:
>
> > Yes it is.
> >
> > You need to run the camel plugin in its own maven execution first so
> > the source is generated prior to running maven again to test or
> > compile or whatever.
> > You cannot run this in a single maven command from clean.
> >
> >
> > On Mon, Mar 28, 2022 at 12:18 PM Minh Tran  wrote:
> > >
> > > Hi
> > >
> > > This is not a chicken and egg problem. I've recreated a basic project
> > > illustrating the problem
> > >
> > > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> > >
> > > mvn clean test. -> will always fail. I've ensured clean will always
> > remove
> > > the autogenerated classes
> > > mvn test -> second attempt without the clean will pass
> > >
> > > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen  wrote:
> > >
> > > > Hi
> > > >
> > > > Its a chicken and egg situation. Therefore its best to use the plugin
> > > > to generate the source code ahead of time, eg in src/generated or
> > > > directly into the source folder - as shown in the doc page.
> > > >
> > > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran 
> > wrote:
> > > > >
> > > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen 
> > wrote:
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > The docs tells you where it outputs and how you can add plugins to
> > > > > > include the src/generated folder
> > > > > >
> > > >
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > > >
> > > > >
> > > > > Yes you can change the defaults but the problem is that the current
> > > > > defaults help to hide the bug in the plugin.
> > > > >
> > > > >
> > > > > >
> > > > > > You can also set which phase to execute the plugin
> > > > > >
> > > > >
> > > > > I tried both generated-sources and compile phase.
> > > > > - generated-sources didn't generate anything.
> > > > > - compile did generate the code but it executes after the compiler
> > runs
> > > > so
> > > > > it never gets a chance to compile it. I tried moving the
> > > > > camel-component-maven-plugin to appear before the
> > maven-compiler-plugin
> > > > in
> > > > > the pom.xml but this seems to have no effect in the order of
> > execution. I
> > > > > am using maven 3.6.0
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



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


Camel Kafka connector can't consume from cluster if one broker is down

2022-03-28 Thread Laurentiu Trica
Hi,

I'm using Camel 2.54 in Karaf 4.3.6 and producing/consuming messages
to/from a Kafka cluster with 3 brokers.
I've tested shutting down a broker to see if the producing/consuming
continues and found out that it's not the case.

Camel *can still send messages to Kafka* (after setting the retries > 0), *but
it doesn't consume messages anymore.*

Everything *works again when the broker comes online again*.

Do you know about this behavior? Is there something I'm missing?

Producer config:
kafka:TOPIC1?brokers=kafka1:29092,kafka2:29092,kafka3:29092retries=100

Consumer config:
kafka:TOPIC1?brokers=kafka1:29092,kafka2:29092,kafka3:29092groupId=GROUP1autoOffsetReset=earliestmaxPollRecords=1

Many thanks!
Laurentiu


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Minh Tran
Are you suggesting we should really be executing the build like this?

mvn clean process-classes test

It works I guess but highly unconventional compared to other maven code
generation plugins. It could also potentially be a big overhead as you're
running the all the phases prior to process-classes twice.

Wouldn't the simplest solution be to fix the plugin to allow generating the
source during the generate-sources phase?

On Mon, 28 Mar 2022 at 21:42, Claus Ibsen  wrote:

> Yes it is.
>
> You need to run the camel plugin in its own maven execution first so
> the source is generated prior to running maven again to test or
> compile or whatever.
> You cannot run this in a single maven command from clean.
>
>
> On Mon, Mar 28, 2022 at 12:18 PM Minh Tran  wrote:
> >
> > Hi
> >
> > This is not a chicken and egg problem. I've recreated a basic project
> > illustrating the problem
> >
> > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> >
> > mvn clean test. -> will always fail. I've ensured clean will always
> remove
> > the autogenerated classes
> > mvn test -> second attempt without the clean will pass
> >
> > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > Its a chicken and egg situation. Therefore its best to use the plugin
> > > to generate the source code ahead of time, eg in src/generated or
> > > directly into the source folder - as shown in the doc page.
> > >
> > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran 
> wrote:
> > > >
> > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen 
> wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > The docs tells you where it outputs and how you can add plugins to
> > > > > include the src/generated folder
> > > > >
> > >
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > >
> > > >
> > > > Yes you can change the defaults but the problem is that the current
> > > > defaults help to hide the bug in the plugin.
> > > >
> > > >
> > > > >
> > > > > You can also set which phase to execute the plugin
> > > > >
> > > >
> > > > I tried both generated-sources and compile phase.
> > > > - generated-sources didn't generate anything.
> > > > - compile did generate the code but it executes after the compiler
> runs
> > > so
> > > > it never gets a chance to compile it. I tried moving the
> > > > camel-component-maven-plugin to appear before the
> maven-compiler-plugin
> > > in
> > > > the pom.xml but this seems to have no effect in the order of
> execution. I
> > > > am using maven 3.6.0
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Claus Ibsen
Yes it is.

You need to run the camel plugin in its own maven execution first so
the source is generated prior to running maven again to test or
compile or whatever.
You cannot run this in a single maven command from clean.


On Mon, Mar 28, 2022 at 12:18 PM Minh Tran  wrote:
>
> Hi
>
> This is not a chicken and egg problem. I've recreated a basic project
> illustrating the problem
>
> git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
>
> mvn clean test. -> will always fail. I've ensured clean will always remove
> the autogenerated classes
> mvn test -> second attempt without the clean will pass
>
> On Mon, 28 Mar 2022 at 19:32, Claus Ibsen  wrote:
>
> > Hi
> >
> > Its a chicken and egg situation. Therefore its best to use the plugin
> > to generate the source code ahead of time, eg in src/generated or
> > directly into the source folder - as shown in the doc page.
> >
> > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran  wrote:
> > >
> > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen  wrote:
> > >
> > > > Hi
> > > >
> > > > The docs tells you where it outputs and how you can add plugins to
> > > > include the src/generated folder
> > > >
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > >
> > >
> > > Yes you can change the defaults but the problem is that the current
> > > defaults help to hide the bug in the plugin.
> > >
> > >
> > > >
> > > > You can also set which phase to execute the plugin
> > > >
> > >
> > > I tried both generated-sources and compile phase.
> > > - generated-sources didn't generate anything.
> > > - compile did generate the code but it executes after the compiler runs
> > so
> > > it never gets a chance to compile it. I tried moving the
> > > camel-component-maven-plugin to appear before the maven-compiler-plugin
> > in
> > > the pom.xml but this seems to have no effect in the order of execution. I
> > > am using maven 3.6.0
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



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


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Minh Tran
Hi

This is not a chicken and egg problem. I've recreated a basic project
illustrating the problem

git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git

mvn clean test. -> will always fail. I've ensured clean will always remove
the autogenerated classes
mvn test -> second attempt without the clean will pass

On Mon, 28 Mar 2022 at 19:32, Claus Ibsen  wrote:

> Hi
>
> Its a chicken and egg situation. Therefore its best to use the plugin
> to generate the source code ahead of time, eg in src/generated or
> directly into the source folder - as shown in the doc page.
>
> On Mon, Mar 28, 2022 at 10:24 AM Minh Tran  wrote:
> >
> > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen  wrote:
> >
> > > Hi
> > >
> > > The docs tells you where it outputs and how you can add plugins to
> > > include the src/generated folder
> > >
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> >
> >
> > Yes you can change the defaults but the problem is that the current
> > defaults help to hide the bug in the plugin.
> >
> >
> > >
> > > You can also set which phase to execute the plugin
> > >
> >
> > I tried both generated-sources and compile phase.
> > - generated-sources didn't generate anything.
> > - compile did generate the code but it executes after the compiler runs
> so
> > it never gets a chance to compile it. I tried moving the
> > camel-component-maven-plugin to appear before the maven-compiler-plugin
> in
> > the pom.xml but this seems to have no effect in the order of execution. I
> > am using maven 3.6.0
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Claus Ibsen
Hi

Its a chicken and egg situation. Therefore its best to use the plugin
to generate the source code ahead of time, eg in src/generated or
directly into the source folder - as shown in the doc page.

On Mon, Mar 28, 2022 at 10:24 AM Minh Tran  wrote:
>
> On Mon, 28 Mar 2022 at 18:14, Claus Ibsen  wrote:
>
> > Hi
> >
> > The docs tells you where it outputs and how you can add plugins to
> > include the src/generated folder
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
>
>
> Yes you can change the defaults but the problem is that the current
> defaults help to hide the bug in the plugin.
>
>
> >
> > You can also set which phase to execute the plugin
> >
>
> I tried both generated-sources and compile phase.
> - generated-sources didn't generate anything.
> - compile did generate the code but it executes after the compiler runs so
> it never gets a chance to compile it. I tried moving the
> camel-component-maven-plugin to appear before the maven-compiler-plugin in
> the pom.xml but this seems to have no effect in the order of execution. I
> am using maven 3.6.0



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


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Minh Tran
On Mon, 28 Mar 2022 at 18:14, Claus Ibsen  wrote:

> Hi
>
> The docs tells you where it outputs and how you can add plugins to
> include the src/generated folder
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate


Yes you can change the defaults but the problem is that the current
defaults help to hide the bug in the plugin.


>
> You can also set which phase to execute the plugin
>

I tried both generated-sources and compile phase.
- generated-sources didn't generate anything.
- compile did generate the code but it executes after the compiler runs so
it never gets a chance to compile it. I tried moving the
camel-component-maven-plugin to appear before the maven-compiler-plugin in
the pom.xml but this seems to have no effect in the order of execution. I
am using maven 3.6.0


Re: camel-component-maven-plugin not hooked to the correct maven phase

2022-03-28 Thread Claus Ibsen
Hi

The docs tells you where it outputs and how you can add plugins to
include the src/generated folder
https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate

You can also set which phase to execute the plugin

On Sat, Mar 26, 2022 at 1:18 PM Minh Tran  wrote:
>
> Hi
>
> According to the docs, this plugin is meant to execute on
> the process-classes phase. However this phase executes after the compile
> phase so the autogenerated class never gets compiled.
>
> If you subsequently run the maven execution again, the compiler picks it up
> the second time around. Unit tests that rely on the generated class will
> always fail the first time and pass on the second. Compounding the issue is
> that the default output directory is src/generated which does not get
> cleaned up when running "mvn clean". If you add this directory to be
> cleaned up by maven-clean-plugin then you can consistently reproduce this
> bug. IMO, camel should be defaulting to generating sources in the target
> directory so it would get cleaned up by default.
>
> I have attempted to change the phase that camel-component-maven-plugin gets
> executed but no classes seem to get generated at all. I tried
> generate-sources and compile phase, neither worked.
>
> This bug pretty much prevents any correct builds happening in the cloud
> (like Bitbucket/Azure pipelines) as everything starts from scratch. If you
> have unit tests that rely on it, the build will fail. If you don't have
> unit tests, then you end up with a jar missing the autogenerated class in
> it.
>
> I am using Camel 3.15.0 and JDK 11



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