Package org.apache.camel.impl

Examples of org.apache.camel.impl.DefaultCamelContext.addRoutes()


        context.bind("bye", new SayService("Good Bye!"));

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

        camelContext.addRoutes(getRouteBuilder(camelContext));

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
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

        jmsComponent.setConnectionFactory(connectionFactory);
        jmsComponent.setRequestTimeout(1000);
        jmsComponent.setReceiveTimeout(1000);
        context.addComponent("jms", jmsComponent);
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("jms:testqueue").bean(new EchoServiceImpl());
                from("direct:test").to("jms:testqueue");
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);
View Full Code Here

        context2.stop();
    }

    private DefaultCamelContext createContext() throws Exception {
        DefaultCamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(Exception.class)
                    .redeliveryDelay(100)
                    .maximumRedeliveries(5)
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

            broker.start();
            server.start();
            // END SNIPPET: e2
            // Add some configuration by hand ...
            // START SNIPPET: e3
            context.addRoutes(new RouteBuilder() {
                public void configure() {
                    // Here we just pass the exception back , don't need to use errorHandler
                    errorHandler(noErrorHandler());
                    from(ROUTER_ENDPOINT_URI).to(SERVICE_ENDPOINT_URI);
                }
View Full Code Here

        // stop and remove the original route
        defaultCamelContext.stopRoute(id);
        defaultCamelContext.removeRouteDefinition(id);

        // add the routes in a route builder
        defaultCamelContext.addRoutes(builder);

        // reserve the id on the newest route
        List<RouteDefinition> routeDefinitions = defaultCamelContext.getRouteDefinitions();
        RouteDefinition route = routeDefinitions.get(routeDefinitions.size() - 1);
        route.setId(id);
View Full Code Here

        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");

        // Note we can explicitly name the component
        context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

        context.addRoutes(new LoanBroker());
        // Start the loan broker
        context.start();
        System.out.println("Server is ready");

        Thread.sleep(5 * 60 * 1000);
 
View Full Code Here

            broker.start();
            server.start();
            // END SNIPPET: e2
            // Add some configuration by hand ...
            // START SNIPPET: e3
            context.addRoutes(new RouteBuilder() {
                public void configure() {
                    from(ROUTER_ENDPOINT_URI).to(SERVICE_ENDPOINT_URI);
                }
            });
            // END SNIPPET: e3
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.