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

Jörg Gonschior commented on CAMEL-16062:
----------------------------------------

Thx for the hint, but we solved it by injecting via Spring the custom client 
into an own implementation of the endpoint.

So we created an own component extending {{WSComponent}},  an own endpoint 
extending {{WsEndpoint}}.

The own client is injected in the endpoint and assigned to the super class in 
the constructor.

 

So from our point of view the issue can be closed.

Thanks in advance

 

P.S.:
We do not use the to uri="" erxpression to assign the url the client should 
connect to. The address is hold by the client directly.

> 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)

Reply via email to