Package org.apache.camel

Examples of org.apache.camel.Producer.process()


        // create a producer that can produce the exchange (= send the mail)
        Producer producer = endpoint.createProducer();
        // start the producer
        producer.start();
        // and let it go (processes the exchange by sending the email)
        producer.process(exchange);
       
        producer.stop();

    }
   
View Full Code Here


        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
        producer.start();
        producer.process(exchange);

        // now lets sleep for a while
        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);
        assertNotNull(receivedExchange.getIn());
View Full Code Here

        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
        producer.start();
        producer.process(exchange);

        // now lets sleep for a while
        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);
        assertNotNull(receivedExchange.getIn());
View Full Code Here

        Producer producer = endpoint.createProducer();
        producer.start();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody("Hello World");
        try {
            producer.process(exchange);
            fail("Should have thrown an ExchangeTimedOutException wrapped in a RuntimeCamelException");
        } catch (Exception e) {
            assertTrue("Should have thrown an ExchangeTimedOutException", e instanceof ExchangeTimedOutException);
        }
        producer.stop();
View Full Code Here

        Exchange exchange = endpoint.createExchange();
        if (header != null) {
            exchange.getIn().setHeader("foo", header);
        }
        Producer producer = endpoint.createProducer();
        producer.process(exchange);

        log.debug("Interceptor invocation order:" + order);
        assertEquals(expected, order);
    }
View Full Code Here

        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);
        producer.stop();
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
View Full Code Here

        Producer producer = endpoint.createProducer();
        // start the producer so it can operate
        producer.start();

        // let the producer process the exchange where it does all the work in this one line of code
        producer.process(exchange);

        // get the response from the out body and cast it to an integer
        int response = exchange.getOut().getBody(Integer.class);
       
        assertEquals("Get a wrong response.", 33, response);
View Full Code Here

                + "?username=admin&password=admin&repositoryId=NON_EXISTING_ID");
        Producer producer = endpoint.createProducer();

        Exchange exchange = createExchangeWithInBody("Some content to be store");
        exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.txt");
        producer.process(exchange);
    }

    @Test
    public void createDocumentAtSpecificPath() throws Exception {
        Folder folder1 = createFolderWithName("Folder1");
View Full Code Here

        Endpoint endpoint = context.getEndpoint("cmis://" + CMIS_ENDPOINT_TEST_SERVER + "?queryMode=true");
        Producer producer = endpoint.createProducer();

        Exchange exchange = createExchangeWithInBody(
                "SELECT * FROM cmis:document WHERE cmis:name = 'test1.txt'");
        producer.process(exchange);

        @SuppressWarnings("unchecked")
        List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
        assertEquals(1, documents.size());
        assertEquals("test1.txt", documents.get(0).get("cmis:name"));
View Full Code Here

        Endpoint endpoint = context.getEndpoint("cmis://" + CMIS_ENDPOINT_TEST_SERVER + "?queryMode=true");
        Producer producer = endpoint.createProducer();

        Exchange exchange = createExchangeWithInBody(
                "SELECT * FROM cmis:document WHERE CONTAINS('Camel test content.')");
        producer.process(exchange);

        @SuppressWarnings("unchecked")
        List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
        assertEquals(2, documents.size());
        assertEquals(2, exchange.getOut().getHeader("CamelCMISResultCount"));
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.