Apache Camel

Presentations

Apache Camel

images/apache_camel_logo.png

Apache Camel

Where? Why?

images/apache_camel_eip1.png.png

images/apache_camel_eip2.png.png

CCX pipelines

images/apache_camel_pipeline.png

Message Translator pattern

images/apache_camel_message_translator.gif

Example #1

public class MyRouteBuilder extends RouteBuilder {

    public void configure() {

        from("file:src/data?noop=true")
            .choice()
                .when(xpath("/person/city = 'London'"))
                    .to("file:target/messages/uk")
                .otherwise()
                    .to("file:target/messages/others");
    }

}

Example #2

 static RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
            from(DIRECT_KAFKA_START).routeId("DirectToKafka")
                    .to("kafka:").log(HEADERS);

            // Topic can be set in header as well.

            from("direct:kafkaStartNoTopic").routeId("kafkaStartNoTopic")
                    .to("kafka:dummy")
                    .log(HEADERS);

            // Use custom partitioner based on the key.

            from(DIRECT_KAFKA_START_WITH_PARTITIONER).routeId("kafkaStartWithPartitioner")
                    .to("kafka:?partitioner=")
                    .log(HEADERS);


            // Takes input from the command line.

            from("stream:in").id("input").setHeader(KafkaConstants.PARTITION_KEY, simple("0"))
                    .setHeader(KafkaConstants.KEY, simple("1")).to(DIRECT_KAFKA_START);

            }
        };
    }

Pros

Cons

Plans (within Processing team)