Kool Camel provides a kotlin based DSL for Apache Camel which is a powerful extension to the Java DSL with Kool Expressions together with adding integration with Kool Streams to provide a typesafe Camel Integration and Event Processing DSL.
The power of the Kool Camel DSL comes from the use of Kool Expressions. These are anonymous function blocks used wherever you can use Camel Expression in the Java DSL. The function blocks take an implicit Camel Exchange object which lets you immediately refer to any of the existing exchange methods together with the extension methods on Exchange without requiring extra noise like a '_' expression in Scala, an 'it' variable in Groovy or a named parameter declaration and variable in Java 8 lambdas which keeps the DSL nice and DRY.
Kool Camel DSL examples
Here are various example patterns using the Kool Camel DSL to show you how DRY it is while still being very easy to read (even if you've never used kotlin before) and how Kool Expressions are integrated into the entire Java DSL:
- message filter
- content based router
- message translator
- message translator and setting headers in the same block
- recipient list
- process block
Camel and Kool Streams
Kool Camel allows you to turn any Camel Endpoint into a Stream<T> using a number of helper methods on the Camel Endpoint class. Once you have a typesafe Stream<T> you can then compose event processing steps (filtering, transforming, grouping, buffering, windowing, merging, correlating etc) with Kool Streams to perform powerful complex event processing.
This allows us to easily compose any Kool Streams and Camel Endpoints and Routes together to combine powerful integration and complex event processing capabilities into a single simple type safe DSL that works directly on your domain model and generates fast statically typed java bytecode without the need for reflection or dynamic invocation.
If you've not tried Kotlin yet, try the Getting Started Guide to install the IDE plugin.