Author: davsclaus Date: Thu Dec 1 18:48:06 2011 New Revision: 1209179 URL: http://svn.apache.org/viewvc?rev=1209179&view=rev Log: CAMEL-4722: Polished example. Thanks to Glen Mazza for the patch.
Modified: camel/trunk/examples/camel-example-aggregate/README.txt camel/trunk/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml Modified: camel/trunk/examples/camel-example-aggregate/README.txt URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-aggregate/README.txt?rev=1209179&r1=1209178&r2=1209179&view=diff ============================================================================== --- camel/trunk/examples/camel-example-aggregate/README.txt (original) +++ camel/trunk/examples/camel-example-aggregate/README.txt Thu Dec 1 18:48:06 2011 @@ -1,24 +1,26 @@ Camel Persistent Aggregate ========================== -This example shows how to use the new feature in Camel 2.3 which is an overhauled -Aggregator EIP which also support persistent store. +This example shows how to use Camel Aggregator EIP which offers (since Camel 2.3) +database persistence. -The example can be run using Maven. +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. -Its an interactive example where you can type in some numbers which then are aggregated. +The example is run using Maven. -You will need to compile this example first: +First compile the example by entering: mvn compile -The example should run if you type: +To run the example type: mvn camel:run -To stop the example hit ctrl + c -If you restart the example you should notice how it remember the aggregated values, as it +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. -If you hit an problems please let us know on the Camel Forums +If you hit any problems please let us know on the Camel Forums http://camel.apache.org/discussion-forums.html This example is documented at @@ -28,7 +30,7 @@ Please help us make Apache Camel better have. Enjoy! ------------------------ -The Camel riders! +The Camel Riders! Modified: camel/trunk/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml?rev=1209179&r1=1209178&r2=1209179&view=diff ============================================================================== --- camel/trunk/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml (original) +++ camel/trunk/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml Thu Dec 1 18:48:06 2011 @@ -24,10 +24,10 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - <!-- this is our aggregation strategy which can aggregate the numbers received as input --> + <!-- This is our aggregation strategy for the numbers received as input --> <bean id="myStrategy" class="org.apache.camel.example.NumberAggregationStrategy"/> - <!-- this is the persistent repository to store aggregated messages --> + <!-- This is the persistent repository to store aggregated messages --> <bean id="myRepo" class="org.apache.camel.component.hawtdb.HawtDBAggregationRepository"> <!-- use data/hawtdb.dat as the persistent store --> <property name="persistentFileName" value="data/hawtdb.dat"/> @@ -37,11 +37,11 @@ <property name="bufferSize" value="602400"/> </bean> - <!-- this is the camel route which asks for input and aggregates the number --> + <!-- This is the Camel route which asks for input and aggregates incoming numbers --> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <route> <!-- ask user to enter a number --> - <from uri="stream:in?promptMessage=Enter a number to be added (use STOP to end, and ctrl+c to shutdown Camel): &promptDelay=1000"/> + <from uri="stream:in?promptMessage=Enter a number to be added (enter STOP to end, and Ctrl-C to shutdown Camel): &promptDelay=1000"/> <!-- aggregate the input, use eagerCheckCompletion to let the completionPredicate easily detect the STOP command --> <aggregate strategyRef="myStrategy" aggregationRepositoryRef="myRepo" eagerCheckCompletion="true"> <!-- aggregate all messages into the same group -->