blob: b2b1fa30e596e08877d2408410f9b4f3eb45cb12 [file] [log] [blame]
== Camel Aggregate
=== Introduction
This example shows how to use Camel Aggregator EIP which offers (since
Camel 2.3) database persistence.
It's an interactive example where you can type in some numbers which
then are aggregated (summed, per this sample's aggregation strategy)
whenever the user types `STOP`.
The user can then enter more numbers to do another aggregation.
==== How it works
The example is an interactive example where it prompts on the console for
you to enter a number and press `ENTER`. The numbers you enter will
then be aggregated and persisted. That means you can at any time hit
`ctrl + c` to shut down Camel.
Then you should be able to start the example again and resume where you
left. When you want to complete the aggregation you can enter `STOP`
as input and Camel will show you the result, which is the sum of all the
numbers entered.
The persistent datastore is located in the `data/hawtdb.dat` file. Its
automatically created the first time.
==== Camel component used in this example
* camel-core
* camel-spring
* camel-stream
=== Build
The example is run using Maven.
First compile the example by entering:
[source,sh]
----
$ mvn compile
----
=== Run
To run the example type:
[source,sh]
----
$ mvn camel:run
----
To stop the example hit `ctrl + c`. If you restart it and resume entering
numbers you should see that it remembered previously entered values, as
it uses a persistent store.
=== Help and contributions
If you hit any problem using Camel or have some feedback, then please
https://camel.apache.org/community/support/[let us know].
We also love contributors, so
https://camel.apache.org/community/contributing/[get involved] :-)
The Camel riders!