apache camel rpc client - Java Message

Java examples for Message:apache camel

Description

apache camel rpc client

Demo Code


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

public class RPCClient {
    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()//from   w  w  w.jav a2 s.  c om
                        .simple("${in.header.body}")
                        .to("rabbitmq://localhost?queue=rpc_queue&rpc=true");
            }
        });
        context.setTracing(true);
        context.start();
    }
}

Related Tutorials