I’ve been trying to figure out what’s going on with this issue (
https://issues.apache.org/jira/browse/CAMEL-9570
<https://issues.apache.org/jira/browse/CAMEL-9570> ) for quite a while now, and
I’m not getting anywhere - I could really use some guidance.
I have a very simple route builder
public class ServiceConsumerBuilder extends RouteBuilder{
Logger log = LoggerFactory.getLogger(this.getClass());
String beanId = "osgi-service";
String timerName = "default-timer";
Object beanInstance;
public ServiceConsumerBuilder() {
}
@Override
public void configure() throws Exception {
fromF( "timer://%s?period=%d&fixedRate=%b", timerName, 5000, true)
.routeId( "java-route")
.setBody().constant( "Dummy Value")
// .bean( beanInstance, "execute", false)
.toF( "bean://%s?cache=%b&method=%s", beanId, false, "execute")
.to( "mock://result")
;
}
public String getTimerName() {
return timerName;
}
public void setTimerName(String timerName) {
this.timerName = timerName;
}
public String getBeanId() {
return beanId;
}
public void setBeanId(String beanId) {
this.beanId = beanId;
}
public Object getBeanInstance() {
return beanInstance;
}
public void setBeanInstance(Object beanInstance) {
Exception ex = new Exception();
ex.fillInStackTrace();
log.info( "Setting beanInstance", ex );
this.beanInstance = beanInstance;
}
public static void main( String[] args ) {
System.out.println( "Hello");
}
}
And when I used the following blueprint, everything works great - dynamic
service changes are picked up.
<?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"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://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">
<cm:property-placeholder persistent-id="blueprint-test"
update-strategy="reload" >
<cm:default-properties>
<cm:property name="timer-name" value="blueprint-consumer" />
</cm:default-properties>
</cm:property-placeholder>
<reference id="osgi-service"
interface="com.pronoia.osgi.service.MyServiceInterface"
filter="implementation=bp-external"/>
<bean id="java-route"
class="com.pronoia.camel.builder.ServiceConsumerBuilder" >
<property name="beanId" value="osgi-service" />
<property name="timerName" value="java-${timer-name}" />
</bean>
<camelContext id="blueprint-context"
xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="java-route" />
</camelContext>
</blueprint>
However, as soon as change the blueprint to the following (I just inject the
service reference into the route builder - but it’s never used/called), I no
longer get dynamic updates.
<?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"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://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">
<cm:property-placeholder persistent-id="blueprint-test"
update-strategy="reload" >
<cm:default-properties>
<cm:property name="timer-name" value="blueprint-consumer" />
</cm:default-properties>
</cm:property-placeholder>
<reference id="osgi-service"
interface="com.pronoia.osgi.service.MyServiceInterface"
filter="implementation=bp-external"/>
<bean id="java-route"
class="com.pronoia.camel.builder.ServiceConsumerBuilder" >
<property name="beanId" value="osgi-service" />
<property name="beanInstance" ref="osgi-service" />
<property name="timerName" value="java-${timer-name}" />
</bean>
<camelContext id="blueprint-context"
xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="java-route" />
</camelContext>
</blueprint>
I’ve been running this in a debugger and trying to figure out what’s going on,
but I’m stuck. Any help/suggestions would be GREATLY appreciated.