blob: d7fd9051fcc68ac600840d263d5bbf71f7d2254d [file] [log] [blame]
== Camel Ehcache Blueprint example
=== Introduction
This example shows how to use `+camel-ehcache+` to cache messages in a
Camel route.
=== Build
You will need to compile this example first:
....
mvn install
....
=== Run with Karaf
To install Apache Camel in Karaf you type in the shell (we use version
$\{camel.version}):
....
feature:repo-add camel ${camel.version}
feature:install camel
....
First you need to install the following features in Karaf with:
....
feature:install camel-ehcache
feature:install camel-servlet
feature:install camel-jackson
....
Then you can install the example:
....
install -s mvn:org.apache.camel.example/camel-example-ehcache-blueprint/${camel.version}
....
And you can see the application running by tailing the logs:
....
log:tail
....
And you can use ctrl+c to stop tailing the log.
There is a data REST service that supports the following operation(s):
* GET /data/\{id} - to get data with the given id from an external
service
From a web browser you can access the service using the following
link(s):
....
http://localhost:8181/camel-example-ehcache-blueprint/data/123 - to get the data with id 123
....
From the command shell you can use `+curl+` to access the service as
shown below:
....
curl -X GET -H "Accept: application/json" http://localhost:8181/camel-example-ehcache-blueprint/data/123
....
The first time you try to get the data it will take 3 seconds as the
example (pretends to) access an external data service. But then the data
will be cached, so it will be quick afterward.
=== Configuration
This example is implemented in XML DSL in the
`+src/main/resources/OSGI-INF/blueprint/camel-context.xml+` file.
=== Help and contributions
If you hit any problem using Camel or have some feedback, then please
https://camel.apache.org/support.html[let us know].
We also love contributors, so
https://camel.apache.org/contributing.html[get involved] :-)
The Camel riders!