I am using Springboot 2.22.0, and I am having a devil of a time using the 
spring-boot autoconfiguraiton with http4 component, according to the 
documentation :

https://github.com/apache/camel/blob/bf5a73cec85825ee1750517fe699540ef5ee4445/docs/components/modules/ROOT/pages/http4-component.adoc

I should be able to set values using the following:

Application.properties:
camel.component.http4.connection-time-to-live=30000
camel.component.http4.connections-per-route=40
camel.component.http4.enabled=true

I have properly tagged the app as a SpringBootApplication, and other values in 
the properties file are indeed being picked up and working as expected, but the 
above ones don’t seem to have any impact:

@SpringBootApplication

Below is the code I am utilizing to try to verify its doing what I expect:

Route:

private synchronized void showStuff(Exchange exchange){
    log.info("  component 
"+exchange.getContext().getComponent("http4",HttpComponent.class));
    log.info("  exchange 
"+exchange.getContext().getComponent("http4",HttpComponent.class).getConnectionTimeToLive());
    log.info(" ex max 
"+(""+getContext().getComponent("http4",HttpComponent.class).getMaxTotalConnections()));
}

@Override
public void configure() {


    from("file:///data/input?fileName=test.txt&move=.done&moveFailed=.error")
            .to(“http4://www.pitt.edu")
            .process(this::showStuff)
            .log("HTTP DONE")

            .end();
}

I have also tried to see the values through the beforeApplication and 
afterApplication start routines:


@Bean
CamelContextConfiguration contextConfiguration() {
    return new CamelContextConfiguration() {

        @Override
        public void beforeApplicationStart(CamelContext context) {

            Log.info("COMPONENTS "+context.getComponentNames());
            HttpComponent c = context.getComponent("http4", 
HttpComponent.class);
            Log.info("TTL "+c.getConnectionTimeToLive());
            Log.info("CM "+c.getClientConnectionManager());
            Log.info("HTTPCOMPONENT "+c);
            Log.info("Max Total "+c.getMaxTotalConnections());
            Log.info("Max Route "+c.getConnectionsPerRoute());
        }

        public void afterApplicationStart(CamelContext context){
            Log.info("COMPONENTS AFTER "+context.getComponentNames());

            HttpComponent c = context.getComponent("http4", 
HttpComponent.class);
            Log.info("TTL "+c.getConnectionTimeToLive());
            Log.info("CM "+c.getClientConnectionManager());
            Log.info("HTTPCOMPONENT "+c);
            Log.info("Max Total "+c.getMaxTotalConnections());
            Log.info("Max Route "+c.getConnectionsPerRoute());
        }
    };
}

Yet every output shows me the same default values for time-to-live and 
connections-per-route… -1 and 20, where I would expect them to be 30000 and 40, 
the values I am putting in the application.properties appear to have no effect. 
 The HttpComponent log also shows the component is indeed consistent and the 
same component all the way through everything.

Is the documentation wrong about these springboot autoconfigs being supported?  
Or am I just doing something wrong in either how I am setting them?  Or how I 
can verify they have been changed?  Am I looking at the wrong object?

Reply via email to