Search code examples
apache-camelfuseesbespercomplex-event-processing

How to include multiple statements in Apache Camel - Esper endpoint?


I have a list of Esper statements which I would like to run within the Apache Camel flow. How can I make sure all statements are evaluated for all messages?

Do I need to have a separate route for each Esper statement (i.e. from: esper:// ...)?

Note: Each statement may be yielding a result at a different time (e.g. aggregating over 1 second, another one over 5 seconds, etc).


Solution

  • According to the documentation, each camel route will start a single event processing statement and consume the results. If you have a reason why you must have a single camel route, craft an EPL statement that performs all the desired work (or at least selects the appropriate data for further processing later in the camel pipeline). The alternative, as you suggest, is to stand up multiple camel routes each consuming from an esper component with a different EPL statement. The multiple routes could later be merged into a single route using one of camel's internal queue components (seda, vm, direct, or jms).

    There is a two route example with source code here.