Package org.apache.camel.impl

Examples of org.apache.camel.impl.DefaultCamelContext.createProducerTemplate()


        context1.start();
        producer1.sendBody("seda://input", "Hey1");
        Exchange ex1 = consumer1.receive("seda://output", 5000);

        DefaultCamelContext context2 = createContext();
        ProducerTemplate producer2 = context2.createProducerTemplate();
        ConsumerTemplate consumer2 = context2.createConsumerTemplate();
        context2.start();

        // now stop 1, and see that 2 is still working
        consumer1.stop();
View Full Code Here


        context.start();

        MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody("direct:start", "Hello World");

        mock.assertIsSatisfied();

        template.stop();
View Full Code Here

        start.expectedMessageCount(1);
        MockEndpoint done = context.getEndpoint("mock:done", MockEndpoint.class);
        done.expectedMessageCount(1);

        // send a message to the route
        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody("direct:start", "Hello Camel");

        // wait for the latch (use 1 minute as fail safe, due unit test)
        assertTrue(latch.await(1, TimeUnit.MINUTES));
View Full Code Here

        start.expectedMessageCount(1);
        MockEndpoint done = context.getEndpoint("mock:done", MockEndpoint.class);
        done.expectedMessageCount(1);

        // send a message to the route
        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody("direct:start", "Hello Camel");

        // just wait a bit for the thread to stop the route
        Thread.sleep(1500);
View Full Code Here

            context.start();

            MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
            mock.setExpectedMessageCount(1);

            ProducerTemplate template = context.createProducerTemplate();
            if (e != null) {
                template.send("direct:in", e);
            } else {
                template.sendBodyAndHeaders("direct:in", payload, headers);
            }
View Full Code Here

                from("direct:start").beanRef("foo");
            }
        });
        camel.start();

        String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
        assertEquals("Hello Camel", reply);

        camel.stop();
    }
View Full Code Here

                from("direct:start").beanRef("foo");
            }
        });
        camel.start();

        String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
        assertEquals("Hello Camel", reply);

        camel.stop();
    }
View Full Code Here

        // add the ActiveMQ component
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:51616");
        context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

        // create a template to use for sending messages to ActiveMQ
        ProducerTemplate template = context.createProducerTemplate();

        // start Camel
        context.start();
       
        for (int i = 0; i < 10; i++) {
View Full Code Here

            }
        });
        // END SNIPPET: e3
        // Camel template - a handy class for kicking off exchanges
        // START SNIPPET: e4
        ProducerTemplate template = context.createProducerTemplate();
        // END SNIPPET: e4
        // Now everything is set up - lets start the context
        context.start();
        // Now send some test text to a component - for this case a JMS Queue
        // The text get converted to JMS messages - and sent to the Queue
View Full Code Here

        context.start();

        MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody("direct:start", "Hello World");

        mock.assertIsSatisfied();

        template.stop();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.