apache camel rpc - Java Message

Java examples for Message:apache camel

Description

apache camel rpc

Demo Code


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

public class RPCServer {

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

        CamelContext context = new DefaultCamelContext();

        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("rabbitmq://localhost?queue=rpc_queue")
                        .setBody()/*from   w ww  .j av  a  2 s . c  om*/
                        .simple("${in.header.RabbitMQRoutingKey}: ${in.body}")
                        .to("stream:out");
            }
        });

        context.setTracing(true);
        context.start();
    }

}

Related Tutorials