apache camel log to rabbitmq - Java Message

Java examples for Message:apache camel

Description

apache camel log to rabbitmq

Demo Code


import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class EmitLogs {
    public static void main(String args[]) throws Exception {

        CamelContext context = new DefaultCamelContext();

        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("timer://simple?period=500")
                        .setBody()/*from   w  w w .  j  a  va2  s. c  om*/
                        .simple("Log message: ${in.headers.CamelTimerCounter}")
                        .to("rabbitmq://localhost?exchange=logs&exchangeType=fanout");
            }
        });
        context.start();
    }

}

Related Tutorials