Package org.apache.camel

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


    public void shouldCreateGetConsumer() throws Exception {
        // Given
        Endpoint dropboxEndpoint = context.getEndpoint("dropbox://" + get + "?accessToken=token&remotePath=/path");

        // When
        Consumer consumer = dropboxEndpoint.createConsumer(null);

        // Then
        Assert.assertTrue(consumer instanceof DropboxScheduledPollGetConsumer);
    }
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 absolute 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

    public void testAutoCreateDirectoryWithDot() throws Exception {
        deleteDirectory("target/file/foo.bar");

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

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

        Endpoint endpoint = context.getEndpoint("file://target/file/foo?autoCreate=false&startingDirectoryMustExist=true");
        try {
            endpoint.createConsumer(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    // noop
                }
            });
            fail("Should have thrown an exception");
View Full Code Here

        Endpoint endpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), null));
       
        final CountDownLatch latch = new CountDownLatch(1);
       
        Consumer consumer = endpoint.createConsumer(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                QuickfixjEventCategory eventCategory =
                    (QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY);
                if (eventCategory == QuickfixjEventCategory.SessionCreated) {
View Full Code Here

        // Start the component and wait for the FIX sessions to be logged on

        final CountDownLatch logonLatch = new CountDownLatch(2);
        final CountDownLatch messageLatch = new CountDownLatch(2);
               
        Consumer consumer = endpoint.createConsumer(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                QuickfixjEventCategory eventCategory =
                    (QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY);
                if (eventCategory == QuickfixjEventCategory.SessionLogon) {
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

        queryBasedConsumer.stop();
    }

    private Consumer createConsumerFor(String path) throws Exception {
        Endpoint endpoint = context.getEndpoint("cmis://" + path);
        return endpoint.createConsumer(new Processor() {
            public void process(Exchange exchange) throws Exception {
                template.send("mock:result", 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.