当前位置: 首页>>代码示例>>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;未经允许,请勿转载。