Package org.apache.camel

Examples of org.apache.camel.CamelContext

Notice: {@link #stop()} and {@link #suspend()} will gracefully stop/suspend routes ensuring any messagesin progress will be given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}.

If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster restart but also allows any internal state to be kept as is. The stop/start approach will do a cold restart of Camel, where all internal state is reset.

End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that when it's being started again using the start method that Camel will operate consistently. @version


        setupMocks();
    }
   
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        dockerConfiguration = new DockerConfiguration();
        dockerConfiguration.setParameters(getDefaultParameters());
       
       
        dockerConfiguration.setClient(getClientProfile(), dockerClient);
       
        DockerComponent dockerComponent = new DockerComponent(dockerConfiguration);
        camelContext.addComponent("docker", dockerComponent);
       

       
        return camelContext;
    }
View Full Code Here


     * Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring
     * context.
     */
    @Bean
    CamelContext camelContext() throws Exception {
        CamelContext camelContext = new SpringCamelContext(applicationContext);

        if (!configurationProperties.isJmxEnabled()) {
            camelContext.disableJMX();
        }

        return camelContext;
    }
View Full Code Here

        assertMockEndpointsSatisfied();
    }
   
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();

        camelContext.addComponent("async", new MyAsyncComponent());

        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                "vm://broker?broker.persistent=false&broker.useJmx=false");
        SjmsComponent component = new SjmsComponent();
        component.setConnectionFactory(connectionFactory);
        camelContext.addComponent("sjms", component);

        return camelContext;
    }
View Full Code Here

        context.getServletHandler().addFilterWithMapping(filterHolder, pathSpec, 0);
    }

    private void enableMultipartFilter(HttpEndpoint endpoint, Server server, String connectorKey) throws Exception {
        ServletContextHandler context = server.getChildHandlerByClass(ServletContextHandler.class);
        CamelContext camelContext = this.getCamelContext();
        FilterHolder filterHolder = new FilterHolder();
        filterHolder.setInitParameter("deleteFiles", "true");
        if (ObjectHelper.isNotEmpty(camelContext.getProperty(TMP_DIR))) {
            File file = new File(camelContext.getProperty(TMP_DIR));
            if (!file.isDirectory()) {
                throw new RuntimeCamelException(
                        "The temp file directory of camel-jetty is not exists, please recheck it with directory name :"
                                + camelContext.getProperties().get(TMP_DIR));
            }
            context.setAttribute("javax.servlet.context.tempdir", file);
        }
        // if a filter ref was provided, use it.
        Filter filter = ((JettyHttpEndpoint) endpoint).getMultipartFilter();
View Full Code Here

        } else {
            httpClient = new CamelHttpClient();
        }
        httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
       
        CamelContext context = endpoint.getCamelContext();

        if (context != null
            && ObjectHelper.isNotEmpty(context.getProperty("http.proxyHost"))
            && ObjectHelper.isNotEmpty(context.getProperty("http.proxyPort"))) {
            String host = context.getProperty("http.proxyHost");
            int port = Integer.parseInt(context.getProperty("http.proxyPort"));
            LOG.debug("CamelContext properties http.proxyHost and http.proxyPort detected. Using http proxy host: {} port: {}", host, port);
            httpClient.setProxy(new Address(host, port));
        }

        if (ObjectHelper.isNotEmpty(endpoint.getProxyHost()) && endpoint.getProxyPort() > 0) {
View Full Code Here

     * @return
     * @throws Exception
     */
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUri);
        connection = connectionFactory.createConnection();
        connection.start();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        SjmsComponent component = new SjmsComponent();
        component.setConnectionCount(1);
        component.setConnectionFactory(connectionFactory);
        camelContext.addComponent("sjms", component);
        return camelContext;
    }
View Full Code Here

        assertTrue(json.contains("\"traceEnabled\": { \"type\": \"boolean\""));
    }

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("netty4-http");
        assertNotNull("Should have found some auto-generated HTML", html);
    }
View Full Code Here

        assertTrue(json.contains("\"maxClientCacheSize\": { \"type\": \"integer\""));
    }

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("cxfrs");
        assertNotNull("Should have found some auto-generated HTML", html);
    }
View Full Code Here

        assertTrue(json.contains("\"resolvedEnableViewMessages\": { \"type\": \"boolean\""));
    }

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("jgroups");
        assertNotNull("Should have found some auto-generated HTML", html);
    }
View Full Code Here

        assertTrue(json.contains(" \"onConsume\": { \"type\": \"string\", \"javaType\": \"java.lang.String\", \"value\": \"foo\""));
    }

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("sql");
        assertNotNull("Should have found some auto-generated HTML", html);
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.CamelContext

Copyright © 2018 www.massapicom. 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.