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


Java DefaultCamelContext.getComponent方法代碼示例

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


在下文中一共展示了DefaultCamelContext.getComponent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testRemoveJob

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
/**
 * Confirm the quartz trigger is removed on route stop.
 */
@Test
public void testRemoveJob() 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+*+*+*+*+?").id("route-1").to("log:one", "mock:one");
        }
    });

    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup2/myTimerName?cron=0/1+*+*+*+*+?").id("route-2").to("log:one", "mock:one");
        }
    });

    camel1.start();

    QuartzComponent component = (QuartzComponent) camel1.getComponent("quartz2");
    Scheduler scheduler = component.getScheduler();
    TriggerKey triggerKey = TriggerKey.triggerKey("myTimerName", "myGroup");
    Trigger trigger = scheduler.getTrigger(triggerKey);
    Assert.assertNotNull(trigger);

    camel1.stopRoute("route-1");

    Trigger.TriggerState triggerState = component.getScheduler().getTriggerState(triggerKey);
    Assert.assertNotNull(trigger);
    Assert.assertEquals(Trigger.TriggerState.PAUSED, triggerState);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:36,代碼來源:QuartzNameCollisionTest.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/2+*+*+*+*+?").to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");

    Scheduler camel1Scheduler = camel1.getComponent("quartz2", QuartzComponent.class).getScheduler();
    QuartzComponent camel2QuartzComponent = camel2.getComponent("quartz2", QuartzComponent.class);
    camel2QuartzComponent.setScheduler(camel1Scheduler);

    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,代碼行數:29,代碼來源:QuartzComponentCamelContextSharedSchedulerTest.java

示例4: testRemoveJob

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
/**
 * Confirm the quartz trigger is removed on route stop.
 */
@Test
public void testRemoveJob() 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+*+*+*+*+?").id("route-1").to("log:one", "mock:one");
        }
    });

    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup2/myTimerName?cron=0/1+*+*+*+*+?").id("route-2").to("log:one", "mock:one");
        }
    });

    camel1.start();

    QuartzComponent component = (QuartzComponent) camel1.getComponent("quartz");
    Scheduler scheduler = component.getScheduler();
    Trigger trigger = scheduler.getTrigger("myTimerName", "myGroup");
    Assert.assertNotNull(trigger);
    
    camel1.stopRoute("route-1");

    int triggerState = component.getScheduler().getTriggerState("myTimerName", "myGroup");
    Assert.assertNotNull(trigger);
    Assert.assertEquals(Trigger.STATE_PAUSED, triggerState);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:35,代碼來源:QuartzNameCollisionTest.java


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