camel-cxfrs : Urls getting interchanged when CamelDestinationOverrideUrl is used

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

camel-cxfrs : Urls getting interchanged when CamelDestinationOverrideUrl is used

sowjanya
Hi,

I have a camel route where I am setting Exchange.DESTINATION_OVERRIDE_URL
header to set a dynamic endpoint url to cxfrs producer component.

Issue with that is lot of times url from previous exchanges is getting set
instead of the freshly calculated url for the current exchange.

In order to fix the issue, I had to configure maxClientCacheSize = 1 on the
cxfrs component.  Below information from http://camel.apache.org/cxfrs.html.

New in 2.6, you can set a IN message header CamelDestinationOverrideUrl to
dynamically override the target destination Web Service or REST Service
defined in your routes.  The implementation caches CXF clients or
ClientFactoryBean in CxfProvider and CxfRsProvider.  This option allows you
to configure the maximum size of the cache.

I looked at the  JAXRSClientFactoryBean code where it caches
ClientFactoryBean but not getting what caused this issue.
was causing issue in the first place. please suggest.

sample trace log for one of the addresses:
[TRACE]: org.apache.camel.component.cxf.CxfEndpointUtils - Client address
is overridden by header 'CamelDestinationOverrideUrl' to value '
https://api.dev.foo.com/dev-ecbo/event/12345/survey?%26%24select%3DQuestion&$expand=Question%28%24filter%3DHelp+eq+%27What+department+are+you+in%3F%27+or+Help+eq+%27What+industry+are+you+in%3F%27+or+Help+eq+%27What%E2%80%99s+your+job+level%3F%27+%29&$filter=+%28Question%2Fany%28x%3A+x%2FHelp+eq+%27What+department+are+you+in%3F%27%29+or+Question%2Fany%28x%3A+x%2FHelp+eq+%27What+industry+are+you+in%3F%27%29+or+Question%2Fany%28x%3A+x%2FHelp+eq+%27What%E2%80%99s+your+job+level%3F%27%29%29
'


Thanks,
Sowjanya.
Reply | Threaded
Open this post in threaded view
|

Re: camel-cxfrs : Urls getting interchanged when CamelDestinationOverrideUrl is used

Alex Dettinger
Hi Sowjanya,

  It reminds me CAMEL-12252
<https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-12252?filter=allissues>.
Do you hit the same issue with the last camel version ?
If yes, could you please provide a test reproducing the bug ?

  Links that could be related:
https://github.com/apache/camel/pull/2218
https://github.com/aldettinger/camel/blob/ed07bef9b521133abb7dd20c2b0e698eaad4b053/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerAddressOverrideTest.java
https://github.com/Talend/apache-camel/blob/master/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml

Alex

On Wed, Oct 31, 2018 at 12:49 AM Sowjanya Mudimala <
[hidden email]> wrote:

> Hi,
>
> I have a camel route where I am setting Exchange.DESTINATION_OVERRIDE_URL
> header to set a dynamic endpoint url to cxfrs producer component.
>
> Issue with that is lot of times url from previous exchanges is getting set
> instead of the freshly calculated url for the current exchange.
>
> In order to fix the issue, I had to configure maxClientCacheSize = 1 on the
> cxfrs component.  Below information from
> http://camel.apache.org/cxfrs.html.
>
> New in 2.6, you can set a IN message header CamelDestinationOverrideUrl to
> dynamically override the target destination Web Service or REST Service
> defined in your routes.  The implementation caches CXF clients or
> ClientFactoryBean in CxfProvider and CxfRsProvider.  This option allows you
> to configure the maximum size of the cache.
>
> I looked at the  JAXRSClientFactoryBean code where it caches
> ClientFactoryBean but not getting what caused this issue.
> was causing issue in the first place. please suggest.
>
> sample trace log for one of the addresses:
> [TRACE]: org.apache.camel.component.cxf.CxfEndpointUtils - Client address
> is overridden by header 'CamelDestinationOverrideUrl' to value '
>
> https://api.dev.foo.com/dev-ecbo/event/12345/survey?%26%24select%3DQuestion&$expand=Question%28%24filter%3DHelp+eq+%27What+department+are+you+in%3F%27+or+Help+eq+%27What+industry+are+you+in%3F%27+or+Help+eq+%27What%E2%80%99s+your+job+level%3F%27+%29&$filter=+%28Question%2Fany%28x%3A+x%2FHelp+eq+%27What+department+are+you+in%3F%27%29+or+Question%2Fany%28x%3A+x%2FHelp+eq+%27What+industry+are+you+in%3F%27%29+or+Question%2Fany%28x%3A+x%2FHelp+eq+%27What%E2%80%99s+your+job+level%3F%27%29%29
> '
>
>
> Thanks,
> Sowjanya.
>