Package org.apache.camel

Examples of org.apache.camel.ProducerTemplate.start()


        // use our own template that has a higher thread pool than default camel that uses 5
        ExecutorService executor = Executors.newFixedThreadPool(10);
        ProducerTemplate pt = new DefaultProducerTemplate(context, executor);
        // must start the template
        pt.start();

        List<Future<Object>> replies = new ArrayList<Future<Object>>(20);
        for (int i = 0; i < 20; i++) {
            Future<Object> out = pt.asyncRequestBody("seda:bar", "Message " + i);
            replies.add(out);
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();
View Full Code Here

        MockEndpoint resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:result");
        resultEndpoint.expectedBodiesReceived(body);

        // now lets send a message
        ProducerTemplate template = context.createProducerTemplate();
        template.start();
        template.send("seda:start", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setHeader("name", "James");
                in.setBody(body);
View Full Code Here

        // and now we can send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

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

        mock.assertIsSatisfied();
    }
View Full Code Here

        // and now we can send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

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

        mock.assertIsSatisfied();
    }
View Full Code Here

        // and now we can send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

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

        mock.assertIsSatisfied();
    }
View Full Code Here

        // send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

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

        mock.assertIsSatisfied();
    }
View Full Code Here

        SpringCamelContext context = applicationContext.getBeansOfType(SpringCamelContext.class).values().iterator().next();
        assertValidContext(context);

        // now lets send a message
        ProducerTemplate template = context.createProducerTemplate();
        template.start();
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setHeader("name", "James");
                in.setBody(body);
View Full Code Here

        MockEndpoint result = camel1.getEndpoint("mock:result", MockEndpoint.class);
        result.expectedBodiesReceived("Hello World");

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

        result.assertIsSatisfied();
View Full Code Here

        MockEndpoint result = camel2.getEndpoint("mock:result", MockEndpoint.class);
        result.expectedBodiesReceived("Bye World");

        ProducerTemplate template = camel2.createProducerTemplate();
        template.start();
        template.sendBody("direct:two", "Bye World");
        template.stop();

        result.assertIsSatisfied();
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.