Package org.apache.camel

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


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

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

        result.assertIsSatisfied();
    }
View Full Code Here


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

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

        result.assertIsSatisfied();
    }
View Full Code Here

        // seda:foo has no consumer in camel-1 so we should not expect any messages to be routed to result/foo
        MockEndpoint result = camel1.getEndpoint("mock:result", MockEndpoint.class);
        result.expectedMessageCount(0);

        ProducerTemplate template = camel1.createProducerTemplate();
        template.start();
        template.sendBody("seda:foo", body);
        template.stop();

        Thread.sleep(200);
       
View Full Code Here

        MockEndpoint foo = camel2.getEndpoint("mock:foo", MockEndpoint.class);
        foo.expectedBodiesReceived(body);

        ProducerTemplate template = camel2.createProducerTemplate();
        template.start();
        template.sendBody("direct:foo", body);
        template.stop();

        result.assertIsSatisfied();
        foo.assertIsSatisfied();
View Full Code Here

        // must use the camel context from osgi
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=" + name + ")", 10000);

        ProducerTemplate myTemplate = ctx.createProducerTemplate();
        myTemplate.start();

        // do our testing
        MockEndpoint foo = ctx.getEndpoint("mock:foo", MockEndpoint.class);
        foo.expectedMessageCount(1);
        MockEndpoint result = ctx.getEndpoint("mock:result", MockEndpoint.class);
View Full Code Here

        // must use the camel context from osgi
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=" + name + ")", 10000);

        ProducerTemplate myTemplate = ctx.createProducerTemplate();
        myTemplate.start();

        // do our testing
        MockEndpoint foo = ctx.getEndpoint("mock:foo", MockEndpoint.class);
        foo.expectedMessageCount(1);
        MockEndpoint result = ctx.getEndpoint("mock:result", MockEndpoint.class);
View Full Code Here

        // endpoint is optional for this injection point
        Endpoint endpoint = getEndpointInjection(endpointUri, endpointRef, injectionPointName, false);
        ProducerTemplate answer = new DefaultProducerTemplate(getCamelContext(), endpoint);
        // start the template so its ready to use
        try {
            answer.start();
        } catch (Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
        return answer;
    }
View Full Code Here

        // must use the camel context from osgi
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=" + name + ")", 5000);

        ProducerTemplate myTemplate = ctx.createProducerTemplate();
        myTemplate.start();

        // do our testing
        MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);
View Full Code Here

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

        // must use the camel context from osgi
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=" + name + ")", 10000);

        ProducerTemplate myTemplate = ctx.createProducerTemplate();
        myTemplate.start();

        // do our testing
        MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);
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.