Package org.apache.camel

Examples of org.apache.camel.CamelContext.start()


            @Override
            public void configure() throws Exception {
                from("direct:start").beanRef("foo");
            }
        });
        camel.start();

        String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
        assertEquals("Hello Camel", reply);

        camel.stop();
View Full Code Here


                from("direct:hello").to("bean:bye");
            }
        });
        // END SNIPPET: route

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
        String rc = proxy.say();
View Full Code Here

        assertTrue(getTestType() == TestType.SIMPLE
            ? policy instanceof SimpleScheduledRoutePolicy
            : policy instanceof CronScheduledRoutePolicy);
        routes.get(0).routePolicy(policy);
        context.addRouteDefinitions(routes);
        context.start();
        return context;
    }
   
    public ClassPathXmlApplicationContext getApplicationContext() {
        return applicationContext;
View Full Code Here

    public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception {
        CamelContext context = new DefaultCamelContext();
        try {
            context.addRoutes(builder);
            context.start();

            MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
            mock.setExpectedMessageCount(1);

            ProducerTemplate template = context.createProducerTemplate();
View Full Code Here

                    .to("log:POJO");
            }
        });           
       
        try {
            context.start();
            fail("Expect to catch an exception here");
        } catch (Exception ex) {
            assertTrue(ex.getMessage().endsWith(
                "Multiple consumers for the same endpoint is not allowed: Endpoint[cxf://http://localhost:7070/test?serviceClass=org.apache.camel.component.cxf.HelloService]"));
        }
View Full Code Here

        CamelContext camelContext = new DefaultCamelContext(context);
        // END SNIPPET: register

        camelContext.addRoutes(getRouteBuilder(camelContext));

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
        String rc = proxy.say();
View Full Code Here

     * A helper method to create a list of Route objects for a given route builder
     */
    public static List<Route> getRouteList(RouteBuilder builder) throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(builder);
        context.start();
        List<Route> answer = context.getRoutes();
        context.stop();
        return answer;
    }

View Full Code Here

        return context;
    }

    public void testMultipleLifecycle() throws Exception {
        CamelContext context = createCamelContext();
        context.start();

        Component log = new LogComponent();
        context.addComponent("log", log);

        context.addEndpoint("log:/foo", log.createEndpoint("log://foo"));
View Full Code Here

                from("direct:hello").to("jdbc:testdb?readSize=100");
            }
        });
        // END SNIPPET: route

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint<Exchange> endpoint = camelContext.getEndpoint("direct:hello");
        CamelTemplate<Exchange> template = new CamelTemplate<Exchange>(camelContext);
        Exchange exchange = endpoint.createExchange();
View Full Code Here

            });
            // END SNIPPET: e3
            // Starting the routing context
            // Using the CXF Client to kick off the invocations
            // START SNIPPET: e4
            context.start();
            Client client = new Client(ROUTER_ADDRESS + "?wsdl");
            // END SNIPPET: e4
            // Now everything is set up - let's start the context

            client.invoke();
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.