Package org.apache.camel

Examples of org.apache.camel.Endpoint.createExchange()


    public void sendInOnly() throws Exception {
        MockEndpoint result = getMockEndpoint("mock:result");
        result.expectedMessageCount(1);
       
        Endpoint start = getMandatoryEndpoint("direct:start");
        Exchange exchange = start.createExchange();
        exchange.setPattern(ExchangePattern.InOnly);
        exchange.getIn().setBody("Hello SMPP World!");

        template.send(start, exchange);
       
View Full Code Here


        assertTrue("Should take longer than: " + delta, delta > 250);
    }

    public void testAsyncProcessWithClassicAPI() throws Exception {
        Endpoint endpoint = context.getEndpoint("direct:start");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("Hello");

        long start = System.currentTimeMillis();

        // produce it async so we use a helper
View Full Code Here

        assertTrue("Should take longer than: " + delta, delta > 250);
    }

    public void testAsyncProcessWithClassicAPIAndTimeout() throws Exception {
        Endpoint endpoint = context.getEndpoint("direct:start");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("Hello");

        long start = System.currentTimeMillis();

        // produce it async so we use a helper
View Full Code Here

    public void testJdbcRoutes() throws Exception {
        // START SNIPPET: invoke
        // first we create our exchange using the endpoint
        Endpoint endpoint = context.getEndpoint("direct:hello");
        Exchange exchange = endpoint.createExchange();
        // then we set the SQL on the in body
        exchange.getIn().setBody("select * from customer order by ID");

        // now we send the exchange to the endpoint, and receives the response from Camel
        Exchange out = template.send(endpoint, exchange);
View Full Code Here

* Unit test for content-type
*/
public class JettyContentTypeTest extends ContextTestSupport {
    protected void sendMessageWithContentType(boolean usingGZip) {
        Endpoint endpoint = context.getEndpoint("http://localhost:9080/myapp/myservice");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("<order>123</order>");
        exchange.getIn().setHeader("user", "Claus");
        exchange.getIn().setHeader("Content-Type", "text/xml");
        if (usingGZip) {
            GZIPHelper.setGZIPMessageHeader(exchange.getIn());
View Full Code Here

        sendMessageWithContentType(true);
    }

    public void testMixedContentType() throws Exception {
        Endpoint endpoint = context.getEndpoint("http://localhost:9080/myapp/myservice");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("<order>123</order>");
        exchange.getIn().setHeader("Content-Type", "text/xml");
        template.send(endpoint, exchange);

        String body = exchange.getOut().getBody(String.class);
View Full Code Here

        container.addRoutes(createRouteBuilder());
        container.start();

        // now lets fire in a message
        Endpoint endpoint = container.getEndpoint("direct:x");
        Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
        Message message = exchange.getIn();
        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
View Full Code Here

        ReverserServer server = new ReverserServer();
        server.start();

        // now lets fire in a message
        Endpoint endpoint = container.getEndpoint("direct:x");
        Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
        Message message = exchange.getIn();
        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
View Full Code Here

        container.addRoutes(builder);
        container.start();

        Endpoint endpoint = container.getEndpoint("direct:a");
        Exchange exchange = endpoint.createExchange();
        if (header != null) {
            exchange.getIn().setHeader("foo", header);
        }
        Producer producer = endpoint.createProducer();
        producer.process(exchange);
View Full Code Here

    private void prepareFtpServer() throws Exception {
        // prepares the FTP Server by creating a file on the server that we want to unit
        // test that we can pool and store as a local file
        Endpoint endpoint = context.getEndpoint(ftpUrl);
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setBody("Hello World from FTPServer");
        exchange.getIn().setHeader(FileComponent.HEADER_FILE_NAME, "hello.txt");
        Producer producer = endpoint.createProducer();
        producer.start();
        producer.process(exchange);
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.