How to deploy apache camel application on wildfly

66
June 27, 2022, at 9:40 PM

I developed an Apache Camel application and I want to deploy it to wildfly. From this guide https://wildfly-extras.github.io/wildfly-camel/index.html I applied the patch and I can deploy successfully on wildfly only if undertow has a different port than wildfly, otherwise there will be a conflict between undertow and wildfly.

How can I deploy camel application on wildfly using the same undertow instance as wildfly?

I'm a junior java developer so please explain with details.

Here my code:

RestConfig.java

@Component("restConfig")
public class RestConfig extends RouteBuilder{
    
    private final String UNDERTOW = "undertow";
    
    @Autowired
    @Value("${undertow.host}")
    private String host;
    
    @Autowired
    @Value("${undertow.port}")
    private Integer port;
    @Override
    public void configure() throws Exception {
        restConfiguration()
        .component(UNDERTOW).host(host).port(port).bindingMode(RestBindingMode.auto).scheme("http")
            .clientRequestValidation(true)
            .dataFormatProperty("prettyPrint", "true")
        .enableCORS(true);
    }
}

GetData.java

@Component("getUser")
public class GetUser extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        rest("/users")
        .get("/{userId}")
            .description("Get user")
            .param().name("userId").type(RestParamType.path).description("User ID").dataType("string").endParam()
        .to("direct:get-user");
    }
}

services-spring-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
 xmlns:util="http://www.springframework.org/schema/util"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:camel="http://camel.apache.org/schema/spring"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.3.xsd 
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    <import resource="classpath:META-INF/cxf/cxf.xml"/>
    <context:component-scan base-package="com....." />
    
    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="restConfig"/>
        <routeBuilder ref="getUser"/>
    </camelContext>
    
</beans>
Rent Charter Buses Company
READ ALSO
How to add a unique tag to each log in logging.properties

How to add a unique tag to each log in logging.properties

My standard configuration of Tomcat 85 splits the logs into

57
How to prevent a token created with OAuth 2.0 from expiring?

How to prevent a token created with OAuth 2.0 from expiring?

I am using the google drive API and am running into a problemI have a JAVA application that follows the documentation steps to implement the service, my problem is with the token that expires every so often

66
Let all instances of object call method at same time (java)

Let all instances of object call method at same time (java)

So I have a superclass called Tile and many subclasses like BlueTile, GreenTile etc

68
change the time interval in spring app using the code

change the time interval in spring app using the code

I have a spring boot applicate that is using many types of date objects it like:

38