Examples of sendBody()


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

        mock.expectedMessageCount(1);

        MockEndpoint error = ctx.getEndpoint("mock:error", MockEndpoint.class);
        error.expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");
        template.sendBody("direct:start", "Kaboom");

        mock.assertIsSatisfied();
        error.assertIsSatisfied();
        template.stop();
View Full Code Here

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

        MockEndpoint error = ctx.getEndpoint("mock:error", MockEndpoint.class);
        error.expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");
        template.sendBody("direct:start", "Kaboom");

        mock.assertIsSatisfied();
        error.assertIsSatisfied();
        template.stop();
    }
View Full Code Here

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

        ProducerTemplate template = ctx.createProducerTemplate();

        MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

        template.sendBody("direct:start", "<hello>world!</hello>");

        mock.assertIsSatisfied();

        ClassLoader tccl = mock.getExchanges().get(0).getProperty(ThreadContextClassLoaderBean.THREAD_CONTEXT_CLASS_LOADER, ClassLoader.class);
        assertNotNull("Exchange property containing TCCL should have been set", tccl);
View Full Code Here

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

        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

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

        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("direct:queue:" + i);
            template.sendBody(e, "Hello");
        }

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

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

    @ManagedOperation(description = "Send body (in only)")
    public void sendBody(String endpointUri, String 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 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()

                from(queueEndpointName).bean(Consumer.class, "consume");
            }
        });
        camelContext.start();
        final ProducerTemplate producerTemplate = camelContext.createProducerTemplate();
        producerTemplate.sendBody(queueEndpointName, "message");
    }

    private void destroyCamelContext() throws Exception {
        log.info("destroying context");
        camelContext.stop();
View Full Code Here

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

                }
            });

            camelContext.start();
            final ProducerTemplate producerTemplate = camelContext.createProducerTemplate();
            producerTemplate.sendBody(queueEndpointName, "message");

            fail("Should have received an exception from the bad URI.");
        } catch(Exception e) {
            // Expected
        }
View Full Code Here

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

        LOG.info("Consuming from: " + destination);
        MessageConsumer consumer = session.createConsumer(destination);

        // now lets send a message
        template.sendBody("seda:consumer", expectedBody);

        Message message = consumer.receive(5000);
        assertNotNull("Should have received a message from destination: " + destination, message);

        TextMessage textMessage = assertIsInstanceOf(TextMessage.class, message);
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.