Examples of sendBody()


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

        List<RouteType> routes = main.getRouteDefinitions();
        assertEquals("Number of routes", 1, routes.size());

        // now lets send a message
        ProducerTemplate template = main.getCamelTemplate();
        template.sendBody("direct:a", expectedBody);

        List<Exchange> o1Messages = o1.getExchanges();
        assertEquals("Expected messages at o1", 1, o1Messages.size());
        LOG.info("o1 received message: " + o1Messages.get(0));
    }
View Full Code Here

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

        ProducerTemplate template = main.getCamelTemplate();
        assertNotNull("should have a template!", template);
        MockEndpoint endpoint = camelContext.getEndpoint(uri, MockEndpoint.class);
        endpoint.expectedBodiesReceived(expectedBody);

        template.sendBody(uri, expectedBody);

        endpoint.assertIsSatisfied();
    }

    @Override
View Full Code Here

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

    }

    public void sendBody(String endpointUri, Object body) throws Exception {
        ProducerTemplate template = context.createProducerTemplate();
        try {
            template.sendBody(endpointUri, body);
        } finally {
            template.stop();
        }
    }
View Full Code Here

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

    public void shouldNotBreakRedeliveriesOfSecondContextAfterFirstBeingStopped() throws Exception {
        DefaultCamelContext context1 = createContext();
        ProducerTemplate producer1 = context1.createProducerTemplate();
        ConsumerTemplate consumer1 = context1.createConsumerTemplate();
        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();
View Full Code Here

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

        // now stop 1, and see that 2 is still working
        consumer1.stop();
        producer1.stop();
        context1.stop();

        producer2.sendBody("seda://input", "Hey2");
        Exchange ex2 = consumer2.receive("seda://output", 5000);

        Assert.assertNotNull(ex1);
        Assert.assertEquals("Hey1", ex1.getIn().getBody());
        Assert.assertNotNull(ex2);
View Full Code Here

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

        MockEndpoint mockB = camelB.getEndpoint("mock:mock2", MockEndpoint.class);
        mockB.expectedBodiesReceived("Hello B");

        ProducerTemplate producer1 = camelA.createProducerTemplate();
        producer1.sendBody("direct:start1", "Hello A");

        ProducerTemplate producer2 = camelB.createProducerTemplate();
        producer2.sendBody("direct:start2", "Hello B");

        // make sure we properly stop the services we created
View Full Code Here

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

        ProducerTemplate producer1 = camelA.createProducerTemplate();
        producer1.sendBody("direct:start1", "Hello A");

        ProducerTemplate producer2 = camelB.createProducerTemplate();
        producer2.sendBody("direct:start2", "Hello B");

        // make sure we properly stop the services we created
        ServiceHelper.stopServices(producer1, producer2);

        mockA.assertIsSatisfied();
View Full Code Here

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

    public void shouldNotBreakRedeliveriesOfSecondContextAfterFirstBeingStopped() throws Exception {
        DefaultCamelContext context1 = createContext();
        ProducerTemplate producer1 = context1.createProducerTemplate();
        ConsumerTemplate consumer1 = context1.createConsumerTemplate();
        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();
View Full Code Here

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

        context2.start();

        // now stop 1, and see that 2 is still working
        context1.stop();

        producer2.sendBody("seda://input", "Hey2");
        Exchange ex2 = consumer2.receive("seda://output", 5000);

        Assert.assertNotNull(ex1);
        Assert.assertEquals("Hey1", ex1.getIn().getBody());
        Assert.assertNotNull(ex2);
View Full Code Here

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

        // get the camel template for Spring template style sending of messages (= producer)
        ProducerTemplate camelTemplate = (ProducerTemplate) context.getBean("camelTemplate");
       
        // as opposed to the CamelClientRemoting example we need to define the service URI in this java code
        int response = (Integer)camelTemplate.sendBody("jms:queue:numbers", ExchangePattern.InOut, 22);
       
        assertEquals("Get a wrong response", 66, response);
       
        context.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.