apache camel route via jetty - Java Message

Java examples for Message:apache camel

Description

apache camel route via jetty

Demo Code


import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.rabbitmq.RabbitMQConstants;
import org.apache.camel.impl.DefaultCamelContext;

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

        CamelContext context = new DefaultCamelContext();

        context.addRoutes(new RouteBuilder() {
            public void configure() {

                from("jetty:http://localhost:10223/topicservice")
                        .setHeader(RabbitMQConstants.ROUTING_KEY,
                                simple("${in.header.level}"))
                        .setBody()/*  w  ww.  j a  v  a2s .  c o m*/
                        .simple("${in.header.body}")
                        .to("rabbitmq://localhost?exchange=topic_logs&exchangeType=topic");
            }
        });
        context.start();
    }
}

Related Tutorials