Package org.apache.camel

Examples of org.apache.camel.Processor


    public void testJmsRequestReplyReplyToAndReplyToHeader() throws Exception {
        // send request to foo, set replyTo to bar, but actually expect reply at baz
        Thread sender = new Thread(new Responder());
        sender.start();

        Exchange reply = template.request("jms:queue:foo", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(REQUEST_BODY);
            }
        });
        assertEquals(EXPECTED_REPLY_BODY, reply.getOut().getBody());
View Full Code Here


                final Destination replyTo = request.getIn().getHeader("JMSReplyTo", Destination.class);
               
                assertEquals(EXPECTED_REPLY_HEADER, replyTo.toString());
               
                // send reply
                template.send("jms:dummy", ExchangePattern.InOnly, new Processor() {
                    public void process(Exchange exchange) throws Exception {

                        Message in = exchange.getIn();
                        in.setBody("Re: " + body);
                        in.setHeader(JmsConstants.JMS_DESTINATION_NAME, "baz");
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("netty4:tcp://localhost:{{port}}?serverInitializerFactory=#spf&textline=true")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                exchange.getOut().setBody("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'");
                            }
                        });
            }
View Full Code Here

                // use the rest DSL to define the rest services
                rest("/users/")
                    .get("{id}/basic")
                        .route()
                        .to("mock:input")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                String id = exchange.getIn().getHeader("id", String.class);
                                exchange.getOut().setBody(id + ";Donald Duck");
                            }
                        });
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("netty4:tcp://localhost:{{port}}?serverInitializerFactory=#spf&sync=true&textline=true")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                exchange.getOut().setBody("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'");
                            }
                        });
            }
View Full Code Here

    Logger log = LoggerFactory.getLogger(TestHelper.class);

    protected void sendText(final String fragment, CamelContext context) throws Exception {
        ProducerTemplate template = context.createProducerTemplate();
        template.start();
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                // Set the property of the charset encoding
                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
                Message in = exchange.getIn();
                in.setBody(fragment);
View Full Code Here

                // use the rest DSL to define the rest services
                rest("/users/")
                    .get("{id}/basic")
                        .route()
                        .to("mock:input")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                String id = exchange.getIn().getHeader("id", String.class);
                                exchange.getOut().setBody(id + ";Donald Duck");
                            }
                        });
View Full Code Here

    }
   
    @Test
    public void testGetCustomerWithClientProxyAPI() {
        // START SNIPPET: ProxyExample
        Exchange exchange = template.send("direct://proxy", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.setPattern(ExchangePattern.InOut);
                Message inMessage = exchange.getIn();
                setupDestinationURL(inMessage);
                // set the operation name
View Full Code Here

        // END SNIPPET: ProxyExample    
    }
   
    @Test
    public void testGetCustomersWithClientProxyAPI() {
        Exchange exchange = template.send("direct://proxy", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.setPattern(ExchangePattern.InOut);
                Message inMessage = exchange.getIn();
                setupDestinationURL(inMessage);
                // set the operation name
View Full Code Here

    }
   
    @Test
    public void testGetCustomerWithHttpCentralClientAPI() {
     // START SNIPPET: HttpExample
        Exchange exchange = template.send("direct://http", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.setPattern(ExchangePattern.InOut);
                Message inMessage = exchange.getIn();
                setupDestinationURL(inMessage);
                // using the http central client API
View Full Code Here

TOP

Related Classes of org.apache.camel.Processor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.