Is there potentially a race condition when calling addRoutes while
camelContext status is 'Initializing'?
I noticed the routes are not actually added in such a case, but no error
or warning appears, they're just silently ignored.
Creating the CamelContext with blueprint, then adding the routes in the
bean, like:
<camelContext id="myCamelContext"
xmlns="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<template id="producerTemplate" />
</camelContext>
<bean id="myBean" class="MyBean" init-method="init">
<property name="camelContext" ref="myCamelContext" />
<property name="producerTemplate" ref="producerTemplate" />
</bean>
Seems basic and it works in 2.x so wondering what has changed.
Workaround is to poll and wait for CamelContext to be in Started state.
BaseService uses a 'lock' during initialization but that's not in use
when adding routes.