HttpMessage.getBody(Map.class) stopped working when migrated from Camel 2 to 3.20.4

2023-06-09 Thread Fyodor Kravchenko

Hello,

I've used to rely on this function in older Camel, when I was able to 
deserialize a regular web form POST stream into a generic java.util.Map, 
I mean, this used to parse the form data (not multipart, just regular) 
and convert into a Map:


Map map = http.getBody(Map.class);

This is my test code snippet that I compile and run on Java 19 of GraalVM:

```

    HttpMessage http = 
exchange.getIn(HttpMessage.class);

    HttpServletRequest request = http.getRequest();
    String method = request.getMethod();
    if ("POST".equals(method) || 
"PUT".equals(method)) {

    Map map = http.getBody(Map.class);
    String string = http.getBody(String.class);
    http.setHeader(Exchange.CONTENT_TYPE, 
"text/plain");
    http.setBody("json: " + 
mapper.writeValueAsString(map) + ", and string:" + string);

    } else {
    http.setHeader(Exchange.CONTENT_TYPE, 
"text/html");

http.setBody(this.getClass().getResourceAsStream("form.html"));
    }
```

I've created a test project to make sure it works on Camel 2.24 and 
doesn't in 3.20.4:


https://github.com/fedd/cameljettyformmap/tree/main/cameljettyformmap

I had to add `javax.activation` for the 2.24 version to run, but 
unfortunately that didn't fix the 3.20.4 (See the pom.xml in the github 
link)


What do I have to do to make it work in 3.20.4?

$ java --version
openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 
19.0.1+10-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 
19.0.1+10-jvmci-22.3-b08, mixed mode, sharing)




Announcing the Community Over Code 2023 Streaming Track

2023-06-09 Thread James Hughes
Hi all,

Community Over Code , the ASF conference,
will be held in Halifax, Nova Scotia October 7-10, 2023. The call for
presentations  is
open now through July 13, 2023.

I am one of the co-chairs for the stream processing track, and we would
love to see you there and hope that you will consider submitting a talk.

About the Streaming track:

There are many top-level ASF projects which focus on and push the envelope
for stream and event processing.  ActiveMQ, Beam, Bookkeeper, Camel, Flink,
Kafka, Pulsar, RocketMQ, and Spark are all house-hold names in the stream
processing and analytics world at this point.  These projects show that
stream processing has unique characteristics requiring deep expertise.  On
the other hand, users need easy to apply solutions.  The streaming track
will host talks focused on the use cases and advances of these projects as
well as other developments in the streaming world.

Thanks and see you in October!

Jim


Re: Issue in resolving endpoint with property having period

2023-06-09 Thread Claus Ibsen
Hi

You are using spring and camel manually where you create spring app context
and whatnot.
Make sure you start spring also, as camel to sync up with spring lifecycle
and startup its services such as type converters, properties and whatnot.

You can only get better help if you put together a small example that
reproduces what you do.



On Fri, Jun 9, 2023 at 12:13 PM Sujeet Singh 
wrote:

> Hi,
>
> Getting the same issue.
>
> Extra information is below for this change
>
> Property with key [time] not found, using default value:  5000
>
> Thanks & Regards,
> Sujeet
>
> On Fri, 9 Jun 2023, 15:10 Mikael Koskinen,  wrote:
>
> > 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
> > > <
> >
> https://stackoverflow.com/questions/72708073/using-timer-component-with-apache-camel-and-the-period-query-parameter-results-i
> > >
> > >
> > > Thanks & Regards,
> > > Sujeet
> > >
> > > On Thu, Jun 8, 2023 at 12:56 PM Sujeet Singh <
> sujeetkumarsi...@gmail.com
> > >
> > > 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 <
> > sujeetkumarsi...@gmail.com>
> > > >> 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/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&period=5000
> > > >> due
> > > >> > to:
> > > >> > > > Error binding property (period = 5000) with name: period on
> > bean:
> > > >> > > > timer://notification?fixedRate=true&period=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
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> >
>


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

Re: Issue in resolving endpoint with property having period

2023-06-09 Thread Sujeet Singh
Hi,

Getting the same issue.

Extra information is below for this change

Property with key [time] not found, using default value:  5000

Thanks & Regards,
Sujeet

On Fri, 9 Jun 2023, 15:10 Mikael Koskinen,  wrote:

> 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
> > <
> https://stackoverflow.com/questions/72708073/using-timer-component-with-apache-camel-and-the-period-query-parameter-results-i
> >
> >
> > 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 <
> sujeetkumarsi...@gmail.com>
> > >> 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/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&period=5000
> > >> due
> > >> > to:
> > >> > > > Error binding property (period = 5000) with name: period on
> bean:
> > >> > > > timer://notification?fixedRate=true&period=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: 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&period=5000
> >> due
> >> > to:
> >> > > > Error binding property (period = 5000) with name: period on bean:
> >> > > > timer://notification?fixedRate=true&period=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: Issue in resolving endpoint with property having period

2023-06-09 Thread Sujeet Singh
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&period=5000
>> due
>> > to:
>> > > > Error binding property (period = 5000) with name: period on bean:
>> > > > timer://notification?fixedRate=true&period=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
>> > > >
>> > >
>> >
>>
>


R: Guaranteed deliveries for spring-rabbitmq producer

2023-06-09 Thread Marco Cordiner
Thanks,
Ok, I thought it was a general exception handling problem; instead I fell into 
a bug related to the specific case of missing RabbitMQ exchange.
So I'll wait for version 3.21.0 or 4.0 to have the issue fixed.

Regards.




Marco Cordiner 

Sytel Reply
Via del Giorgione, 59
00147 - Roma - ITALY 
phone: +39 06 844341
mobile: +39 335 1900199
m.cordi...@reply.it
www.reply.it
-Messaggio originale-
Da: Claus Ibsen  
Inviato: lunedì 5 giugno 2023 18:45
A: users@camel.apache.org
Oggetto: Re: Guaranteed deliveries for spring-rabbitmq producer

Hi

Take a look at CAMEL-19008 it seems maybe what you asked for

On Mon, Jun 5, 2023 at 11:45 AM Marco Cordiner  wrote:

> Hi All,
> I'm trying to setup a simple camel route (camel.springboot 3.20.4) 
> that exposes a rest endpoint, sends a message to RabbitMQ using the 
> spring-rabbitmq component and finally replies to the rest endpoint 
> with the outcome of enqueue.
> The ko response is managed through an onException clause within the route.
> When everything is ok the route works fine.
> The problem arises when something goes wrong in the RabbitMQ 
> operation; for example if the exchange doesn't exist.
> In this case, despite of this error is logged:
>
> Shutdown Signal: channel error; protocol method:
> #method(reply-code=404, reply-text=NOT_FOUND - no 
> exchange 'exc-test' in vhost '/', class-id=60, method-id=40)
>
> no exception is thrown and the ruote terminates as if everything was ok.
> I couldn't find any parameter to instruct the spring-rabbitmq 
> component to send back any exception to the calling route.
>
> Using the "old" rabbitmq component, I could achieve this result using 
> the parameter "camel.component.rabbitmq.guaranteed-deliveries=true" 
> but documentation recommends to use the Spring component instead.
>
> Is there an equivalent parameter for the spring-rabbitmq component?
>
> Regards.
> Marco
>
>
> Marco Cordiner
>
> Sytel Reply
> Via del Giorgione, 59
> 00147 - Roma - ITALY
> phone: +39 06 844341
> mobile: +39 335 1900199
> m.cordi...@reply.it
> www.reply.it
>


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