Package org.apache.camel

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


    public void testMocksAreValid() throws Exception {
        assertNotNull(camelContext);
        assertNotNull(resultEndpoint);

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader("jms:requestQueue", "Willem", CxfConstants.OPERATION_NAME, "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(4000);
        template.stop();
View Full Code Here


        ProducerTemplate producer = new DefaultProducerTemplate(context, context.getEndpoint("direct:in"));

        getMockEndpoint("mock:result").expectedMessageCount(3);

        producer.sendBody("Hello");
        producer.sendBodyAndHeader("Hello", "foo", 123);
        Map<String, Object> headers = new HashMap<String, Object>();
        producer.sendBodyAndHeaders("Hello", headers);

        assertMockEndpointsSatisfied();
    }
View Full Code Here

        producer.start();

        getMockEndpoint("mock:result").expectedMessageCount(3);

        producer.sendBody("Hello");
        producer.sendBodyAndHeader("Hello", "foo", 123);
        Map<String, Object> headers = new HashMap<String, Object>();
        producer.sendBodyAndHeaders("Hello", headers);

        assertMockEndpointsSatisfied();
View Full Code Here

        // now send a lot of messages
        System.out.println("Writing files ...");

        for (int i = 0; i < SIZE; i++) {
            producer.sendBodyAndHeader("file:target//inbox", "File " + i, Exchange.FILE_NAME, i + ".txt");
        }

        System.out.println("... Wrote " + SIZE + " files");

        // we're done so let's properly close the application context
View Full Code Here

        assertNotNull(camelContext);

        ProducerTemplate template = camelContext.createProducerTemplate();
        List<String> params = new ArrayList<String>();
        params.add("Willem");
        Object result = template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut ,
                                                   params, CxfConstants.OPERATION_NAME, "greetMe");
        assertTrue("Result is a list instance ", result instanceof List);
        assertEquals("Get the wrong response", ((List)result).get(0), "HelloWillem");

        template.stop();
View Full Code Here

    public void testMocksAreValid() throws Exception {
        assertNotNull(camelContext);
        assertNotNull(resultEndpoint);

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader("jms:requestQueue", "Willem", CxfConstants.OPERATION_NAME, "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(4000);
        template.stop();
View Full Code Here

       
        resultEndpoint.reset();
        fileEndpoint.reset();
       
        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader("direct:start", "Hello form Willem", "Operation", "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(2000);
        template.stop();
View Full Code Here

    public void testMocksAreValid() throws Exception {
        assertNotNull(resultEndpoint);
        resultEndpoint.reset();

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader("jetty:http://localhost:9000/test", "Hello form Willem", "Operation", "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(4000);
        template.stop();
View Full Code Here

        producer.start();

        getMockEndpoint("mock:result").expectedMessageCount(3);

        producer.sendBody("Hello");
        producer.sendBodyAndHeader("Hello", "foo", 123);
        Map<String, Object> headers = new HashMap<String, Object>();
        producer.sendBodyAndHeaders("Hello", headers);

        assertMockEndpointsSatisfied();
View Full Code Here

    public void testMocksAreValid() throws Exception {
        assertNotNull(resultEndpoint);
        resultEndpoint.reset();

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader(URL, "Hello form Willem", "Operation", "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(4000);
        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.