Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19510

camel-spring-boot-examples - Fix the reactive-streams

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.20.6, 4.0-M3
    • 3.22.0, 4.0-RC2
    • None
    • None
    • Unknown

    Description

      While playing with the example reactive-streams of camel-spring-boot-examples, I realized that:

      With Camel 3.21 the rest endpoint defined in RestExample fails with the next error:

      java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Long (java.lang.String and java.lang.Long are in module java.base of loader 'bootstrap')
      	at org.apache.camel.example.reactive.streams.RestExample$RestExampleStreams.lambda$sum$0(RestExample.java:52) ~[classes/:na]
      	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxZip$ZipCoordinator.drain(FluxZip.java:735) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxZip$ZipInner.onNext(FluxZip.java:894) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at org.apache.camel.component.reactive.streams.util.MonoPublisher$1.request(MonoPublisher.java:54) ~[camel-reactive-streams-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at reactor.core.publisher.FluxZip$ZipInner.onSubscribe(FluxZip.java:881) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at org.apache.camel.component.reactive.streams.util.MonoPublisher.subscribe(MonoPublisher.java:39) ~[camel-reactive-streams-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at reactor.core.publisher.FluxZip$ZipCoordinator.subscribe(FluxZip.java:579) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxZip.handleBoth(FluxZip.java:326) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxZip.handleArrayMode(FluxZip.java:267) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxZip.subscribe(FluxZip.java:136) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.FluxMap.subscribe(FluxMap.java:62) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at reactor.core.publisher.Flux.subscribe(Flux.java:7968) ~[reactor-core-3.2.16.RELEASE.jar:3.2.16.RELEASE]
      	at org.apache.camel.component.reactive.streams.util.UnwrapStreamProcessor.process(UnwrapStreamProcessor.java:42) ~[camel-reactive-streams-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:477) ~[camel-core-processor-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181) ~[camel-base-engine-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) ~[camel-base-engine-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:165) ~[camel-core-processor-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:392) ~[camel-base-engine-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83) ~[camel-base-engine-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:41) ~[camel-support-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.http.common.CamelServlet.doExecute(CamelServlet.java:333) ~[camel-http-common-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:228) ~[camel-http-common-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.http.common.CamelServlet.handleService(CamelServlet.java:146) ~[camel-http-common-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:95) ~[camel-http-common-3.21.0-SNAPSHOT.jar:3.21.0-SNAPSHOT]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.70.jar:4.0.FR]
      
      

      With Camel 4, it is even worse because no route starts:

      2023-06-27T15:53:02.430+02:00  INFO 40276 --- [           main] a.c.e.r.s.a.ReactiveStreamsSpringBootApp : No active profile set, falling back to 1 default profile: "default"
      2023-06-27T15:53:04.194+02:00  INFO 40276 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
      2023-06-27T15:53:04.204+02:00  INFO 40276 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
      2023-06-27T15:53:04.204+02:00  INFO 40276 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.10]
      2023-06-27T15:53:04.318+02:00  INFO 40276 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
      2023-06-27T15:53:04.319+02:00  INFO 40276 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1773 ms
      2023-06-27T15:53:05.406+02:00  INFO 40276 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
      2023-06-27T15:53:05.528+02:00  INFO 40276 --- [           main] o.a.c.c.s.CamelHttpTransportServlet      : Initialized CamelHttpTransportServlet[name=CamelServlet, contextPath=]
      2023-06-27T15:53:05.530+02:00  INFO 40276 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
      2023-06-27T15:53:05.616+02:00  INFO 40276 --- [           main] o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 4.0.0-SNAPSHOT (camel-1) is starting
      2023-06-27T15:53:05.622+02:00  INFO 40276 --- [           main] o.a.c.impl.engine.AbstractCamelContext   : Routes startup (started:0)
      2023-06-27T15:53:05.623+02:00  INFO 40276 --- [           main] o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 4.0.0-SNAPSHOT (camel-1) started in 6ms (build:0ms init:0ms start:6ms)
      
      

      Attachments

        Activity

          People

            nfilotto Nicolas Filotto
            nfilotto Nicolas Filotto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: