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


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

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


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

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("elasticsearch");
        assertNotNull("Should have found some auto-generated HTML", html);
        assertTrue("Expected entry for clusterName", html.contains("<td>clusterName</td>"));
        assertTrue("Expected entry for protocolType", html.contains("<td>protocolType</td>"));
    }
View Full Code Here

    public Exchange doTestSignatureRoute(RouteBuilder builder) throws Exception {
        return doSignatureRouteTest(builder, null, Collections.<String, Object> emptyMap());
    }

    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();
            if (e != null) {
                template.send("direct:in", e);
            } else {
                template.sendBodyAndHeaders("direct:in", payload, headers);
            }
            assertMockEndpointsSatisfied();
            return mock.getReceivedExchanges().get(0);
        } finally {
            context.stop();
        }
    }
View Full Code Here

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

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

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        LOG.trace("Execute job: {}", context);

        CamelContext camelContext = getCamelContext(context);

        Runnable task = (Runnable) context.getJobDetail().getJobDataMap().get("task");

        if (task == null) {
            // if not task then use the route id to lookup the consumer to be used as the task
            String routeId = (String) context.getJobDetail().getJobDataMap().get("routeId");
            if (routeId != null && camelContext != null) {
                // find the consumer
                for (Route route : camelContext.getRoutes()) {
                    if (route.getId().equals(routeId)) {
                        Consumer consumer = route.getConsumer();
                        if (consumer instanceof Runnable) {
                            task = (Runnable) consumer;
                            break;
View Full Code Here

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

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

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

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

public class UriConfigurationTest extends Assert {

    @Test
    public void testComponentConfiguration() throws Exception {
        CamelContext context = new DefaultCamelContext();

        BeanstalkComponent comp = context.getComponent("beanstalk", BeanstalkComponent.class);
        EndpointConfiguration conf = comp.createConfiguration("beanstalk:tube?command=put");

        assertEquals("put", conf.getParameter("command"));

        ComponentConfiguration compConf = comp.createComponentConfiguration();
View Full Code Here

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

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

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

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("beanstalk");
        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.