[ 
https://issues.apache.org/jira/browse/CAMEL-19851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764192#comment-17764192
 ] 

Nicolas Filotto commented on CAMEL-19851:
-----------------------------------------

For now, the only way to set a timeout is like any other complex type, you need 
to define a dedicated bean in your Spring boot context and refer to that bean 
in the configuration of your component as described in the documentation 
https://camel.apache.org/camel-spring-boot/4.0.x/starter-configuration.html#_using_external_configuration.

That being said, I do agree that we can do better for this particular type.

> spring-boot Allow to configure timeouts natively
> ------------------------------------------------
>
>                 Key: CAMEL-19851
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19851
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-http
>    Affects Versions: 4.x
>         Environment:  
>  
>            Reporter: Valeriy Ak
>            Assignee: Nicolas Filotto
>            Priority: Major
>
> In http component we have some properties with type 
> org.apache.hc.core5.util.Timeout:
>  * camel.component.http.connect-timeout
>  * camel.component.http.connection-request-timeout
>  * camel.component.http.response-timeout
>  * camel.component.http.so-timeout
> We can set this properies by spring boot prop file 
> ([documentation|https://camel.apache.org/components/4.0.x/http-component.html#_spring_boot_auto_configuration]).
>  
>  
> However in current realization it is not posible to set thouse values because 
> converter don't create Timeout object, it try to get bean with this name from 
> spring context 
> [HttpComponentConverter|https://github.com/apache/camel-spring-boot/blob/camel-spring-boot-4.0.x/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java#L77]
>  , if bean not present it alwayes return null value (withou any excaptions or 
> warrnigs(!))
>  
> It is not correct behavior - and correct way is convert value to [Duration 
> |https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations]and
>  then call Timeout.of(duration)
>  
> Please fix converter for org.apache.hc.core5.util.Timeout class
>  
> Examples:
> {code:java}
> camel:
>   component:
>     http:
>       so-timeout: PT30S
> ---
> bean HttpComponentConfiguration.soTimeout=null
> camel: 
>   component: 
>     http: 
>       so-timeout: 1000
> --- 
> Exception on start - Caused by: 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.lang.Integer] to type 
> [org.apache.hc.core5.util.Timeout]{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to