Package org.apache.camel

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


            MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
            mock.setExpectedMessageCount(1);

            ProducerTemplate template = context.createProducerTemplate();
            if (e != null) {
                template.send("direct:in", e);
            } else {
                template.sendBodyAndHeaders("direct:in", payload, headers);
            }
            verify(mock);
            return mock.getReceivedExchanges().get(0);
View Full Code Here


        resultEndpoint.expectedBodiesReceived(body);

        // now lets send a message
        ProducerTemplate template = context.createProducerTemplate();
        template.start();
        template.send("seda:start", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setHeader("name", "James");
                in.setBody(body);
            }
View Full Code Here

        for (int i = 0; i < messages; i++) {
            Exchange e = targetEndpoint.createExchange();
            e.getIn().setBody("<message>" + i + "</message>");
            // only send if we are still started
            if (context.getStatus().isStarted()) {
                myTemplate.send(targetEndpoint, e);
                sentExchanges.add(e);
                Thread.sleep(100);
            }
        }
        myTemplate.stop();
View Full Code Here

            MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
            mock.setExpectedMessageCount(1);

            ProducerTemplate template = context.createProducerTemplate();
            if (e != null) {
                template.send("direct:in", e);
            } else {
                template.sendBodyAndHeaders("direct:in", payload, headers);
            }
            assertMockEndpointsSatisfied();
            return mock.getReceivedExchanges().get(0);
View Full Code Here

    @Test
    public void testSendingRequest() throws Exception {
        assertNotNull("the camelContext should not be null", camelContext);
        ProducerTemplate template = camelContext.createProducerTemplate();
        Exchange exchange = template.send("jetty:http://localhost:9000/test", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody("<hello>Willem</hello>");
                exchange.getIn().setHeader("Operation", "greetMe");
            }
View Full Code Here

        for (int i = 0; i < messages; i++) {
            Exchange e = targetEndpoint.createExchange();
            e.getIn().setBody("<message>" + i + "</message>");
            // only send if we are still started
            if (context.getStatus().isStarted()) {
                myTemplate.send(targetEndpoint, e);
                sentExchanges.add(e);
                Thread.sleep(100);
            }
        }
        myTemplate.stop();
View Full Code Here

    @Test
    public void testSendingRequest() throws Exception {
        assertNotNull("the camelContext should not be null", camelContext);
        ProducerTemplate template = camelContext.createProducerTemplate();
        Exchange exchange = template.send(URL, new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody("<hello>Willem</hello>");
                exchange.getIn().setHeader("Operation", "greetMe");
            }
View Full Code Here

        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean("camel");
        assertValidContext(context);

        // now lets send a message
        ProducerTemplate template = context.createProducerTemplate();
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setHeader("name", "James");
                in.setBody(body);
            }
View Full Code Here

        MockEndpoint resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:result");
        resultEndpoint.expectedBodiesReceived(body);

        // now lets send a message
        ProducerTemplate template = context.createProducerTemplate();
        template.send("seda:start", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setHeader("name", "James");
                in.setBody(body);
            }
View Full Code Here

            Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
            exchange.getIn().setHeader(HbaseAttribute.HBASE_ROW_ID.asHeader(), key[0]);
            exchange.getIn().setHeader(HbaseAttribute.HBASE_FAMILY.asHeader(), family[0]);
            exchange.getIn().setHeader(HbaseAttribute.HBASE_QUALIFIER.asHeader(), column[0][0]);
            exchange.getIn().setHeader(HBaseConstants.OPERATION, HBaseConstants.GET);
            Exchange resp = template.send(endpoint, exchange);
            assertEquals(body[0][0][0], resp.getOut().getHeader(HbaseAttribute.HBASE_VALUE.asHeader()));
        }
    }

    @Test
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.