I have a minimal camel route with a cxf endpoint (in a RouteBuilder#configure method):
CxfRsComponent cxfComponent = new CxfRsComponent(context);
CxfRsEndpoint serviceEndpoint = new CxfRsEndpoint("http:/localhost/rest", cxfComponent);
serviceEndpoint.addResourceClass(PersonService.class);
serviceEndpoint.setPerformInvocation(true);
from(serviceEndpoint).log("this is irrelevant");
The issue is that the methods of the resource class are called twice:
Let's say there is a "PersonService#post" method:
public Person post(Person p){
p.setId(p.getId() + "_PersonService#post");
return p;
}
It gets invoced twice: breakpoints get hit twice, response for payload
{
"id" : "id_from_client"
}
is
{
"id": "id_from_client_PersonService#post_PersonService#post"
}
Is this expected behaviour? If yes, is there a setting to only execute the method once? This seems like a bug to me.
Camel version is 2.16.2 (maven: org.apache.camel:camel-cxf-transport:2.16.2) CXF version is 3.1.4 (org.apache.cxf:cxf-rt-transports-http-jetty:3.1.4)
FWIW, I changed my configuration to add the "synchronous=true" option along with "performInvocation=true" and the double calls went away. I'm not sure if this is how it's supposed to behave or not, but for now it seems to work OK this way.
<camel:from uri="cxfrs:bean:rsServer performInvocation=true&synchronous=true" />