Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.18.0
-
None
-
Unknown
Description
When a simple java RouteBuilder that creates a component and adds it to the context in the configure method is used in a blueprint, the context cannot find the component.
Example Builder:
public class TimerRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception
}
Example Blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="timer-route-builder" class="com.pronoia.camel.builder.TimerRouteBuilder"/>
<camelContext id="blueprint-context" xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="timer-route-builder"/>
</camelContext>
</blueprint>
This test fails:
public class BlueprintTest extends CamelBlueprintTestSupport {
@EndpointInject(uri = "mock://result")
MockEndpoint result;
@Override
protected String getBlueprintDescriptor()
@Test
public void testRoute() throws Exception
}
But this test passes
public class CamelTest extends CamelTestSupport {
@EndpointInject(uri = "mock://result")
MockEndpoint result;
@Override
protected RoutesBuilder createRouteBuilder() throws Exception { return new TimerRouteBuilder(); }
@Test
public void testRoute() throws Exception { result.expectedMessageCount(5); assertMockEndpointsSatisfied(10, TimeUnit.SECONDS); }
}
Attachments
Issue Links
- breaks
-
CAMEL-12291 Blueprint error: "name is already instanciated as null and cannot be removed"
- Resolved
- links to