I have a camel cxf-rs endpoint that splits the requests into two main parts.
form("cxfrs:bean:rsServer")
.when(isForward()).to("cxfrs:http://example.com")
.otherwise().process(myCustomDispatcher) // i want to get rid of this custom dispatcher
The first part is straight forwarded to a different service.
For the second part i would like to dispatch/call classes/methods that have jaxrs annotation. Currently i have a custom processor myCustomerDispatcher
that duplicates the logic from the annotations and dispatches manually to classes and methods. Especially @Path
and @PathParams
are duplicated.
I tried:
to("bean:MyJaxRsImplemantion")
this will work for beans with a single method matching the parameters in the camel exchange, but does not consider jax-rs annotations.Serveral combinations with
to("cxfrs:bean:cxfEndpoint?resourceClasses=MyJaxRsImplemantion")
. it either requires a forwarding address, or acts on a new endpoint creating camel exchanges. I couldn't find a way to call the actual implementation.The ProduceTemplates all seem to handle singular paths or situations.
Question:
How can i write a camel route that actually calls jax-rs resource methods without forwarding to a new service?
This is actually a really tough question. For one, even when you google it you don't get any straight answers. After an eternity of web surfing, it feels like it's the law of the land for camel routes to call jx-rs resource methods by forwarding to a new service. And yes, it's almost like
to("bean:MyJxRsImplemantion")
is DESIGNED to ignore jax-rs annotations. So I've decided that it's impossible. Sorry.