Package org.apache.camel

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


            final Integer idx = i;
            executors.execute(new Runnable() {
                public void run() {
                    try {
                        for (int j = 0; j < SIZE / POOL; j++) {
                            producer.sendBody("jms:queue:inbox", "Message " + idx.intValue() * j + j);
                        }
                    } finally {
                        latch.countDown();
                    }
                }
View Full Code Here


        ProducerTemplate producer = new DefaultProducerTemplate(context, context.getEndpoint("direct:in"));
        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

        assertEquals("Size should be 0", 0, template.getCurrentCacheSize());

        // test that we cache at most 500 producers to avoid it eating to much memory
        for (int i = 0; i < 503; i++) {
            Endpoint e = context.getEndpoint("seda:queue:" + i);
            template.sendBody(e, "Hello");
        }

        assertEquals("Size should be 500", 500, template.getCurrentCacheSize());
        template.stop();
View Full Code Here

        assertEquals("Size should be 0", 0, template.getCurrentCacheSize());

        // test that we cache at most 500 producers to avoid it eating to much memory
        for (int i = 0; i < 203; i++) {
            Endpoint e = context.getEndpoint("seda:queue:" + i);
            template.sendBody(e, "Hello");
        }

        assertEquals("Size should be 200", 200, template.getCurrentCacheSize());
        template.stop();
View Full Code Here

        mock.expectedPropertyReceived("addressLine1", addressLine1);

        String csvLine = "\"PROBLEM SOLVER\",\"" + addressLine1
                         + "\",\"SUITE 104\",\"RALEIGH\",\"NC\",\"27615\",\"US\"";
        ProducerTemplate template = ctx.createProducerTemplate();
        template.sendBody("direct:fromCsv", csvLine.trim());

       
        mock.assertIsSatisfied();

        // The algorithm of BindyCvsDataFormat.unquoteTokens(..) does not handle
View Full Code Here

        mock.expectedPropertyReceived("addressLine1", addressLine1);

        String csvLine = "\"PROBLEM SOLVER\",\"" + addressLine1
                         + "\",\"SUITE 104\",\"RALEIGH\",\"NC\",\"27615\",\"US\"";
        ProducerTemplate template = ctx.createProducerTemplate();
        template.sendBody("direct:fromCsv", csvLine.trim());
       
        mock.assertIsSatisfied();

    }
View Full Code Here

        mock.expectedPropertyReceived("addressLine1", addressLine1);

        String csvLine = "\"PROBLEM SOLVER\",\"" + addressLine1
                         + "\",\"SUITE 104\",\"RALEIGH\",\"NC\",\"27615\",\"US\"";
        ProducerTemplate template = ctx.createProducerTemplate();
        template.sendBody("direct:fromCsv", csvLine.trim());
       
        mock.assertIsSatisfied();

    }
View Full Code Here

        assertEquals("Size should be 0", 0, template.getCurrentCacheSize());

        // test that we cache at most 500 producers to avoid it eating to much memory
        for (int i = 0; i < 503; i++) {
            Endpoint e = context.getEndpoint("seda:queue:" + i);
            template.sendBody(e, "Hello");
        }

        assertEquals("Size should be 500", 500, template.getCurrentCacheSize());
        template.stop();
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();
    }

    @After
View Full Code Here

    }

    @ManagedOperation(description = "Send body (in only)")
    public void sendBody(String endpointUri, String body) throws Exception {
        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody(endpointUri, body);
        template.stop();
    }

    @ManagedOperation(description = "Request body (in out)")
    public Object requestBody(String endpointUri, String body) throws Exception {
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.