You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alphonse Bendt <al...@gmail.com> on 2023/09/21 11:01:56 UTC
How do I setup camel-rest in combination with spring-webflux-netty?
Hi folks,
Within a Spring boot application I want to use camel-rest as consumer to be able to define rest endpoints:
from(„rest://get/hello-world“).constant(„Some static content“)
This works fine with the spring-boot-starter-web which uses Tomcat:
Get http://localhost:8080/rest/hello-world => 200
Now I was trying to achieve the same with spring-boot-starter-webflux + netty
What I did so far is:
* exchange spring-boot-starter-web with spring-boot-sterter-webflux
* add camel-netty-http
* configured the rest component to use netty-http instead of servlet: getRestConfiguration().setComponent("netty-http“)
I can see in the log output that the route still is being registered however cannot be accessed in the spring application
Get http://localhost:8080/rest/hello-world => 404
I am assuming that a new ServerPort is being opened instead of hooking into the one already provided by spring?
How do i configure things so that the rest endpoint is accessible via the Spring server port? Can anyone show me directions?
Thanks in advance,
Alphonse
Re: How do I setup camel-rest in combination with spring-webflux-netty?
Posted by Alphonse Bendt <al...@gmail.com>.
Hi,
Thanks for that. Unfortunately this does not seem to work for me. My steps:
* added dependency to camel-platform-http-starter
* this has a transitive dependency on spring-boot-starter-web and tomcat, so I excluded them from the dependencies
* reconfigure camel-rest: getRestConfiguration().setComponent("platform-http“)
With this configuration I get classnotfoundexceptions while trying to run the springboottests.
java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
I’ll stick with spring-boot-starter-web and tomcat for now.
Thanks so far!
> Am 21.09.2023 um 13:25 schrieb Claus Ibsen <cl...@gmail.com>:
>
> Hi
>
> Use the platform-http for the consumer - then you use what spring comes
> with as http server.
>
>
> On Thu, Sep 21, 2023 at 1:04 PM Alphonse Bendt <al...@gmail.com>
> wrote:
>
>> Hi folks,
>>
>> Within a Spring boot application I want to use camel-rest as consumer to
>> be able to define rest endpoints:
>>
>> from(„rest://get/hello-world“).constant(„Some static content“)
>>
>> This works fine with the spring-boot-starter-web which uses Tomcat:
>>
>> Get http://localhost:8080/rest/hello-world => 200
>>
>> Now I was trying to achieve the same with spring-boot-starter-webflux +
>> netty
>>
>> What I did so far is:
>> * exchange spring-boot-starter-web with spring-boot-sterter-webflux
>> * add camel-netty-http
>> * configured the rest component to use netty-http instead of servlet:
>> getRestConfiguration().setComponent("netty-http“)
>>
>> I can see in the log output that the route still is being registered
>> however cannot be accessed in the spring application
>> Get http://localhost:8080/rest/hello-world => 404
>>
>> I am assuming that a new ServerPort is being opened instead of hooking
>> into the one already provided by spring?
>>
>> How do i configure things so that the rest endpoint is accessible via the
>> Spring server port? Can anyone show me directions?
>>
>> Thanks in advance,
>> Alphonse
>>
>>
>>
>>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
Re: How do I setup camel-rest in combination with spring-webflux-netty?
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Use the platform-http for the consumer - then you use what spring comes
with as http server.
On Thu, Sep 21, 2023 at 1:04 PM Alphonse Bendt <al...@gmail.com>
wrote:
> Hi folks,
>
> Within a Spring boot application I want to use camel-rest as consumer to
> be able to define rest endpoints:
>
> from(„rest://get/hello-world“).constant(„Some static content“)
>
> This works fine with the spring-boot-starter-web which uses Tomcat:
>
> Get http://localhost:8080/rest/hello-world => 200
>
> Now I was trying to achieve the same with spring-boot-starter-webflux +
> netty
>
> What I did so far is:
> * exchange spring-boot-starter-web with spring-boot-sterter-webflux
> * add camel-netty-http
> * configured the rest component to use netty-http instead of servlet:
> getRestConfiguration().setComponent("netty-http“)
>
> I can see in the log output that the route still is being registered
> however cannot be accessed in the spring application
> Get http://localhost:8080/rest/hello-world => 404
>
> I am assuming that a new ServerPort is being opened instead of hooking
> into the one already provided by spring?
>
> How do i configure things so that the rest endpoint is accessible via the
> Spring server port? Can anyone show me directions?
>
> Thanks in advance,
> Alphonse
>
>
>
>
--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2