You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/02/03 08:10:00 UTC

[jira] [Commented] (CAMEL-16062) Custom AsyncHttpClient is ignored when using ahc-ws component

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

Claus Ibsen commented on CAMEL-16062:
-------------------------------------

You should use # syntax

camel.component.ahc-ws.client = #bean:asyncHttpClientTimeseriesImpl

> Custom AsyncHttpClient is ignored when using ahc-ws component
> -------------------------------------------------------------
>
>                 Key: CAMEL-16062
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16062
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ahc-ws
>    Affects Versions: 3.4.4
>            Reporter: Jörg Gonschior
>            Priority: Major
>
> Hello,
> we have defined a Spring based custom instance of AsyncHttpClient. This instance should be used by adding the property
> {code:java}
> camel.component.ahc-ws.client = asyncHttpClientTimeseriesImpl{code}
> to yaml file.
> The implementation looks like this:
>  
> {code:java}
> @Component
> @RequiredArgsConstructor
> public class AsyncHttpClientTimeseriesImpl extends DefaultAsyncHttpClient {
> /* ... custom members ... */
> @Override
>  @SuppressWarnings("ConstantConditions")
>  public synchronized BoundRequestBuilder prepareGet(String url) {
>   /* a token is requested to be added to the httpHeaders */
> }
> {code}
>  
> When using the ahc-wss endpoint in a route, the custom client is never used. Instead a DefaultAsyncHttpClient is instanciated and will fail to connect, due to missing httpHeader containing the valid token.
> Example of the route:
> {code:java}
> <route id="distributorCloudRoute">
>   <from uri="seda:distributorEntryPoint?multipleConsumers=true"/>
>   <to uri="ahc-wss:<url_of_externalHost>"/>
> </route>{code}
>  
> used dependencies from pom.xml:
> {code:java}
> <parent>
>   <groupId>org.springframework.boot</groupId>
>   <artifactId>spring-boot-dependencies</artifactId>
>   <version>2.2.0.RELEASE</version>
> </parent>
> <apache-camel.version>3.4.4</apache-camel.version>
> <dependency>
>   <groupId>org.apache.camel.springboot</groupId>
>   <artifactId>camel-spring-boot-starter</artifactId>
>   <version>${apache-camel.version}</version>
> </dependency>
> <dependency>
>   <groupId>org.apache.camel.springboot</groupId>
>   <artifactId>camel-ahc-ws-starter</artifactId>
>   <version>${apache-camel.version}</version>
> </dependency>{code}
>  
> In the former version that was used - Camel 3.1.0 - the error didn't occur.
> It would be nice if you can confirm the wrong behaviour of AHC-WS component and give an possible version containing the fix.
> Best regards
> Jörg Gonschior
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)