當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultCamelContext.start方法代碼示例

本文整理匯總了Java中org.apache.camel.impl.DefaultCamelContext.start方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultCamelContext.start方法的具體用法?Java DefaultCamelContext.start怎麽用?Java DefaultCamelContext.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.camel.impl.DefaultCamelContext的用法示例。


在下文中一共展示了DefaultCamelContext.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@PostConstruct
public void start() throws Exception {
    camel = new DefaultCamelContext();
    camel.start();

    final Component component = camel.getComponent(getConnectorAction(), true, false);
    if (component == null) {
        log.error("Component {} does not exist", getConnectorAction());
    } else {
        verifier = component.getExtension(verifierExtensionClass).orElse(null);
        if (verifier == null) {
            log.warn("Component {} does not support verifier extension", getConnectorAction());
        }

    }
}
 
開發者ID:syndesisio,項目名稱:syndesis-verifier,代碼行數:17,代碼來源:BaseVerifier.java

示例2: createRegistry

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // let's create our black box as a Camel context and a set of routes
    DefaultCamelContext blackBox = new DefaultCamelContext(registry);
    blackBox.setName("blackBox");
    blackBox.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // we received purchase orders, so let's process it in some way then
            // send an invoice to our invoice endpoint
            from("direct:purchaseOrder").setHeader("received").constant("true").to("direct:invoice");
        }
    });
    blackBox.start();

    registry.bind("accounts", blackBox);
    return registry;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:JavaDslBlackBoxTest.java

示例3: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?").to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextTest.java

示例4: testThirdCamelContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Test
public void testThirdCamelContext() throws Exception {
    camel1.stop();
    
    camel2.stop();
            
    DefaultCamelContext camel3 = new DefaultCamelContext();
    camel3.setName("camel-3");
    camel3.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myThirdGroup/myThirdTimerName?cron=0/1+*+*+*+*+?").to("mock:three");
        }
    });
    camel3.start();
    
    MockEndpoint mock3 = camel3.getEndpoint("mock:three", MockEndpoint.class);
    mock3.expectedMinimumMessageCount(2);
    
    mock3.assertIsSatisfied();
    camel3.stop();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextTest.java

示例5: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("myCamel");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired one")
                .to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("myCamel");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired two")
                .to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:27,代碼來源:QuartzTwoCamelContextSameNameClashTest.java

示例6: startRoute

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
private void startRoute(DefaultCamelContext ctx, final String proxy, final String real) throws Exception {

        ctx.addRoutes(new RouteBuilder() {
            public void configure() {
                
                List<String> serviceList = new ArrayList<String>();
                serviceList.add(SERVICE_ADDRESS_1);
                serviceList.add(SERVICE_ADDRESS_2);

                SequentialStrategy strategy = new SequentialStrategy();
                strategy.setAlternateAddresses(serviceList);

                LoadDistributorFeature ldf = new LoadDistributorFeature();
                ldf.setStrategy(strategy);

                CxfEndpoint endpoint = (CxfEndpoint)(endpoint(real));
                endpoint.getFeatures().add(ldf);

                from(proxy).to(endpoint);
            }
        });
        ctx.start();

    }
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:25,代碼來源:LoadDistributorFeatureTest.java

示例7: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("myCamel");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired one")
                .to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("myCamel");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired two")
                .to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:27,代碼來源:QuartzTwoCamelContextSameNameClashTest.java

示例8: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?").to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextTest.java

示例9: testNoStatefulCollisionError

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
/**
 * Don't check for a name collision if the job is stateful.
 */
@Test
public void testNoStatefulCollisionError() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?stateful=true&cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    QuartzComponent component2 = new QuartzComponent(camel2);

    component2.createEndpoint("quartz://myGroup/myTimerName?stateful=true");
    // if no exception is thrown then this test passed.
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:22,代碼來源:QuartzNameCollisionTest.java

示例10: testDupeNameMultiContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Test
public void testDupeNameMultiContext() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    QuartzComponent component2 = new QuartzComponent(camel2);
    component2.createEndpoint("quartz://myGroup/myTimerName");
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:QuartzNameCollisionTest.java

示例11: CamelSink

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
public CamelSink(JsonObject config) {
    endpoint = config.getString("endpoint");
    camelContext = new DefaultCamelContext();
    try {
        camelContext.start();
        producerTemplate = camelContext.createProducerTemplate();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:11,代碼來源:CamelSink.java

示例12: init

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void init() throws Exception {
    context = new DefaultCamelContext();
    camel = new CamelComponent(context);
    context.start();
    
}
 
開發者ID:cschneider,項目名稱:reactive-components,代碼行數:8,代碼來源:CamelComponentTest.java

示例13: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:13,代碼來源:QuartzOneCamelContextRestartTest.java

示例14: testProducer

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
public void testProducer() throws Exception {
    // use shutdown hook to verify that we have stopped within 5 seconds
    Thread hook = new AssertShutdownHook();
    Runtime.getRuntime().addShutdownHook(hook);

    start = System.currentTimeMillis();

    context = new DefaultCamelContext();
    context.addRoutes(createRouteBuilder());
    context.start();

    sendMessage();

    context.stop();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:16,代碼來源:MinaProducerShutdownTest.java

示例15: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:13,代碼來源:QuartzOneCamelContextRestartTest.java


注:本文中的org.apache.camel.impl.DefaultCamelContext.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。