LevelDBPage edited by Claus IbsenChanges (1)
Full ContentLevelDBAvailable as of Camel 2.10 Leveldb is a very lightweight and embedable key value database. It allows together with Camel to provide persistent support for various Camel features such as Aggregator. Current features it provides:
Using LevelDBAggregationRepositoryLevelDBAggregationRepository is an AggregationRepository which on the fly persists the aggregated messages. This ensures that you will not loose messages, as the default aggregator will use an in memory only AggregationRepository. It has the following options:
The repositoryName option must be provided. Then either the persistentFileName or the levelDBFile must be provided. What is preserved when persistingLevelDBAggregationRepository will only preserve any Serializable compatible data types. If a data type is not such a type its dropped and a WARN is logged. And it only persists the Message body and the Message headers. The Exchange properties are not persisted. RecoveryThe LevelDBAggregationRepository will by default recover any failed Exchange. It does this by having a background tasks that scans for failed Exchanges in the persistent store. You can use the checkInterval option to set how often this task runs. The recovery works as transactional which ensures that Camel will try to recover and redeliver the failed Exchange. Any Exchange which was found to be recovered will be restored from the persistent store and resubmitted and send out again. The following headers is set when an Exchange is being recovered/redelivered:
Only when an Exchange has been successfully processed it will be marked as complete which happens when the confirm method is invoked on the AggregationRepository. This means if the same Exchange fails again it will be kept retried until it success. You can use option maximumRedeliveries to limit the maximum number of redelivery attempts for a given recovered Exchange. You must also set the deadLetterUri option so Camel knows where to send the Exchange when the maximumRedeliveries was hit. You can see some examples in the unit tests of camel-leveldb, for example this test. Using LevelDBAggregationRepository in Java DSLIn this example we want to persist aggregated messages in the target/data/leveldb.dat file. Using LevelDBAggregationRepository in Spring XMLThe same example but using Spring XML instead: DependenciesTo use LevelDB in your camel routes you need to add the a dependency on camel-leveldb. If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions). <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-leveldb</artifactId> <version>2.10.0</version> </dependency>
Stop watching space
|
Change email notification preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Camel > LevelDB Claus Ibsen (Confluence)
- [CONF] Apache Camel > LevelDB Claus Ibsen (Confluence)