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


        Destination destination = assertIsInstanceOf(Destination.class, replyTo);
        assertEquals("ReplyTo", replyQueue.toString(), destination.toString());
    }

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

        // START SNIPPET: example
        camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false"));
        // END SNIPPET: example

        return camelContext;
    }
View Full Code Here


        assertMockEndpointsSatisfied();
    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext context = super.createCamelContext();

        PropertiesComponent pc = new PropertiesComponent();
        pc.setLocation("classpath:org/apache/camel/component/properties/myproperties.properties");
        context.addComponent("properties", pc);

        Properties initial = new Properties();
        initial.put("first", "mock:first");
        initial.put("second", "second");
        pc.setInitialProperties(initial);
View Full Code Here

* Starter for the Jms2RestAdpter to run it easily from Eclipse
*/
public class Starter {

    public void run() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addComponent("properties", new PropertiesComponent("sampleconfig.properties"));
        context.addRoutes(new OrderRouteBuilder());
        context.start();
        System.in.read();
        context.stop();
    }
View Full Code Here

*/
public class Jpa2JmsStarter {

   
    public void run() throws Exception {
        CamelContext context = new DefaultCamelContext();
        addJmsComponent(context);
        context.setTracing(true);
        context.addRoutes(new Jpa2JmsRoute());
        context.start();
        System.in.read();
        context.stop();
    }
View Full Code Here

*/
public class Jms2RestStarter {

   
    public void run() throws Exception {
        CamelContext context = new DefaultCamelContext();
        JmsConfiguration jmsConfig = new JmsConfiguration(new ActiveMQConnectionFactory("tcp://localhost:61616"));
        context.addComponent("jms", new JmsComponent(jmsConfig ));
        context.setTracing(true);
        context.addRoutes(new Jms2RestRoute());
        context.start();
        System.in.read();
        context.stop();
    }
View Full Code Here

*/
public class VotingStarter {

   
    public void run() throws Exception {
        CamelContext context = new DefaultCamelContext();
        TwitterComponent twitterComponent = context.getComponent("twitter", TwitterComponent.class);
        twitterComponent.setConsumerKey("");
        twitterComponent.setConsumerSecret("");
        twitterComponent.setAccessToken("");
        twitterComponent.setAccessTokenSecret("");
        context.setTracing(true);
        context.addRoutes(new VotingRoutes());
        context.start();
        System.in.read();
        context.stop();
    }
View Full Code Here

*/
public class ManagedCamelContextTest extends ManagementTestSupport {

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext context = super.createCamelContext();
        // to force a different management name than the camel id
        context.getManagementNameStrategy().setNamePattern("19-#name#");
        return context;
    }
View Full Code Here

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

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

     * @param ognl  methods to invoke on the body in a simple OGNL syntax
     */
    public static Expression camelContextOgnlExpression(final String ognl) {
        return new ExpressionAdapter() {
            public Object evaluate(Exchange exchange) {
                CamelContext context = exchange.getContext();
                if (context == null) {
                    return null;
                }
                return new MethodCallExpression(context, ognl).evaluate(exchange);
            }
View Full Code Here

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

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