AHC

TheĀ AHC component calls external servers using the HTTP protocol. Learn how to use the AHC component.

Library

Create a new library with the following jars (in this order):

Camel version Library jars
2.18.3

(1) this jar is a fork of the standard Apache Camel AHC 2.18.2 component source code that avoids conflicts with standard libraries

See How to retrieve the Camel version of Decision Insight.

Routes

Now it's possible to create a route that uses this component. Here the definition of the route:

<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <!-- Call only one time -->
        <from uri="timer:one?repeatCount=10"/>
        <!-- Send the HTTP request and convert the result as String -->
        <to uri="ahc:https://www.google.com/humans.txt"/>
        <convertBodyTo type="java.lang.String"/>
        <!-- Log the result -->
        <to uri="log:robots"/>
    </route>
</routes>

Related Links