Search in sources :

Example 1 with ControlBusComponent

use of org.apache.camel.component.controlbus.ControlBusComponent in project camel by apache.

the class ControlBusComponentAutoConfiguration method configureControlBusComponent.

@Lazy
@Bean(name = "controlbus-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ControlBusComponent.class)
public ControlBusComponent configureControlBusComponent(CamelContext camelContext) throws Exception {
    ControlBusComponent component = new ControlBusComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : ControlBusComponent(org.apache.camel.component.controlbus.ControlBusComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ControlBusComponent

use of org.apache.camel.component.controlbus.ControlBusComponent in project camel by apache.

the class ControlBusComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@Test
public void testComponentConfiguration() throws Exception {
    ControlBusComponent comp = context.getComponent("controlbus", ControlBusComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("controlbus:route?routeId=bar&action=stop");
    assertEquals("bar", conf.getParameter("routeId"));
    assertEquals("stop", conf.getParameter("action"));
    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);
    assertTrue(json.contains("\"action\": { \"kind\": \"parameter\", \"displayName\": \"Action\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"async\": { \"kind\": \"parameter\", \"displayName\": \"Async\", \"group\": \"producer\", \"type\": \"boolean\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) EndpointConfiguration(org.apache.camel.EndpointConfiguration) ControlBusComponent(org.apache.camel.component.controlbus.ControlBusComponent) Test(org.junit.Test)

Aggregations

ControlBusComponent (org.apache.camel.component.controlbus.ControlBusComponent)2 ComponentConfiguration (org.apache.camel.ComponentConfiguration)1 EndpointConfiguration (org.apache.camel.EndpointConfiguration)1 Test (org.junit.Test)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 Lazy (org.springframework.context.annotation.Lazy)1