camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Johnson <>
Subject Invoking a REST client
Date Thu, 18 Aug 2016 23:03:48 GMT
Most of the switch over from using XML route builders to Java route
builders is fairly painless and straightforward and the new CDI is a
pleasure to work with.  But there are certain aspects that I'm not quite
familiar with like how to do the same thing as this in the Java DSL,

<!-- Defined the client endpoint to create the cxf-rs consumer -->
  <cxf:rsClient id="rsClient" address="http://localhost: <http://localhost/>

    loggingFeatureEnabled="true" skipFaultLogging="true">
       <ref bean="jsonProvider"/>

  <!-- The camel route context -->
  <camelContext id="camel" xmlns="">
       <!-- Just need to ignoreDeleteMethodMessageBody -->
       <from uri="cxfrs://bean://rsServer"/>
       <to uri="log:body?level=INFO"/>
       <to uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true

If I have an interface like this:

public interface InventoryClient {

  InventoryTransaction getInventory(@PathParam("id") Integer id);

I can easily create a Java bean and use JAXRSClientFactory to create the
client and use it or even use a CDI Producer to create it for injection.
The only issue then is the multi-threading and how that might be handled
and then doing things like calling reset on the client after an invocation.
While I can do it it seems like I should be able to simply set up a route:


in a route builder but obviously that's predicated on setting up the
client. How does that setup translate?

  <cxf:rsClient id="inventoryClient" address="https:// <http://localhost/>

I'd rather let Camel handle the underlying issues of resource management
than do all that myself.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message