Package org.apache.camel

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


        mock.expectedMessageCount(1);

        template.sendBody("jms:in", "Hello World");

        Endpoint endpoint = context.getEndpoint("jms:out");
        endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                assertEquals("Bye World", exchange.getIn().getBody(String.class));
            }
        });
View Full Code Here


            MockEndpoint mock = getMockEndpoint("mock:result");
            mock.expectedBodiesReceived("Hello");

            // can not use route builder as we need to have the file created in the setup before route builder starts
            Endpoint endpoint = context.getEndpoint("stream:file?fileName=./target/stream/streamfile.txt&delay=100");
            Consumer consumer = endpoint.createConsumer(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    template.send("mock:result", exchange);
                }
            });
            consumer.start();
View Full Code Here

        } finally {
            fos.close();
        }

        Endpoint endpoint = comp.createEndpoint("file://target/consumefile", "target/consumefile", new HashMap<String, Object>());
        Consumer consumer = endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                assertNotNull(exchange);
                String body = exchange.getIn().getBody(String.class);
                assertEquals("Hello World", body);
                latch.countDown();
View Full Code Here

        } finally {
            fos.close();
        }

        Endpoint endpoint = comp.createEndpoint("file://target/consumefile", "target/consumefile", new HashMap());
        Consumer consumer = endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                assertNotNull(exchange);
                String body = exchange.getIn().getBody(String.class);
                assertEquals("Hello World", body);
                latch.countDown();
View Full Code Here

    private void bindToRegistry(JndiRegistry jndi) throws Exception {
        Component comp = new DirectComponent();
        comp.setCamelContext(context);

        Endpoint slow = comp.createEndpoint("direct:somename");
        Consumer consumer = slow.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                template.send("mock:result", exchange);
            }
        });
        consumer.start();
View Full Code Here

    public void testCreateDirectory() throws Exception {
        deleteDirectory("target/file/foo");

        Endpoint endpoint = context.getEndpoint("file://target/file/foo");
        Consumer consumer = endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                // noop
            }
        });
View Full Code Here

        deleteDirectory("target/file/foo");
        // use current dir as base as aboslute path
        String base = new File("").getAbsolutePath() + "/target/file/foo";

        Endpoint endpoint = context.getEndpoint("file://" + base);
        Consumer consumer = endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                // noop
            }
        });
View Full Code Here

    public void testDoNotCreateDirectory() throws Exception {
        deleteDirectory("target/file/foo");

        Endpoint endpoint = context.getEndpoint("file://target/file/foo?autoCreate=false");
        Consumer consumer = endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                // noop
            }
        });
View Full Code Here

            Endpoint endpoint = getEndpointInjection(annotation.uri(), annotation.name());
            if (endpoint != null) {
                try {
                    Processor processor = createConsumerProcessor(bean, method, endpoint);
                    log.info("Created processor: " + processor);
                    Consumer consumer = endpoint.createConsumer(processor);
                    consumer.start();
                    addConsumer(consumer);
                }
                catch (Exception e) {
                    log.warn(e);
View Full Code Here

        String injectionPointName = method.getName();
        Endpoint endpoint = getEndpointInjection(endpointUri, endpointName, injectionPointName, true);
        if (endpoint != null) {
            try {
                Processor processor = createConsumerProcessor(bean, method, endpoint);
                Consumer consumer = endpoint.createConsumer(processor);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Created processor: " + processor + " for consumer: " + consumer);
                }
                startService(consumer, bean, beanName);
            } catch (Exception e) {
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.