Package org.apache.camel

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


        // get the camel template for Spring template style sending of messages (= producer)
        ProducerTemplate camelTemplate = context.getBean("camelTemplate", ProducerTemplate.class);
       
        // 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

    }

    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

        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundleFixed)", 10000);

        ProducerTemplate template = ctx.createProducerTemplate();

        MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
        template.sendBody("direct:start", "World");
        mock.assertIsSatisfied();

        MBeanServer mbeanServer = ctx.getManagementStrategy().getManagementAgent().getMBeanServer();

        assertEquals("cool", ctx.getManagementName());
View Full Code Here

    }

    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

        getInstalledBundle("CamelBlueprintHdfsTestBundle").start();
        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintHdfsTestBundle)", 20000);

        ProducerTemplate template = ctx.createProducerTemplate();
        template.sendBody("direct:start", "CIAO");

        MockEndpoint resultEndpoint = ctx.getEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.assertIsSatisfied();
    }
View Full Code Here

    }

    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

        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.expectedBodiesReceived(allBrothers);

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

        assertMockEndpointsSatisfied();
    }

    @Override
View Full Code Here

        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

        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

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.