[
https://issues.apache.org/jira/browse/CAMEL-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15328047#comment-15328047
]
Quinn Stevenson commented on CAMEL-9570:
----------------------------------------
I found a workaround - I haven't tested it throughly, but it works in the basic
case of my test.
I extended the BlueprintCamelContext, and then used that context as a normal
bean rather than using the camel blueprint extension namespace.
Here's the extended context I used
public class SimpleCamelBlueprintContext extends BlueprintCamelContext {
public SimpleCamelBlueprintContext(BundleContext bundleContext,
BlueprintContainer blueprintContainer) {
super(bundleContext, blueprintContainer);
}
public void setRoute(RouteBuilder builder) throws Exception {
this.addRoutes(builder);
}
@Override
public void init() throws Exception {
super.init();
super.start();
}
@Override
public void destroy() throws Exception {
super.destroy();
}
}
And here's a sample blueprint snippit
<bean id="bean-route" class="com.pronoia.camel.builder.BeanConsumerBuilder">
<property name="timerName" value="$camel{timerName}" />
<property name="timerPeriod" value="$camel{timerPeriod}" />
<property name="trace" value="$camel{trace}" />
<property name="cacheBean" value="$camel{cacheBean}" />
<property name="beanInstance" ref="alternate-service" />
<!--
<property name="beanInstance" ref="alternate-service" />
<property name="beanInstance" ref="osgi-service" />
<property name="beanInstance" >
<bean class="com.pronoia.osgi.service.MyServiceWrapper" >
<property name="delegate" ref="osgi-service" />
</bean>
</property>
-->
</bean>
<bean id="simple-camel-context"
class="com.pronoia.camel.context.SimpleCamelBlueprintContext"
init-method="init" destroy-method="destroy">
<argument index="0" ref="blueprintBundleContext" />
<argument index="1" ref="blueprintContainer" />
<property name="route" ref="bean-route" />
</bean>
So as near as I can tell, something in the camel blueprint namespace extension
is causing the issue.
> Blueprint Proxies are not used when injected into Java RouteBuilders
> --------------------------------------------------------------------
>
> Key: CAMEL-9570
> URL: https://issues.apache.org/jira/browse/CAMEL-9570
> Project: Camel
> Issue Type: Bug
> Components: camel-blueprint, camel-core
> Affects Versions: 2.16.2
> Reporter: Quinn Stevenson
> Assignee: Christian Schneider
>
> Basic Conditions:
> - Java interface used for OSGi Services
> - Implementation of the Java interface registered as a OSGi service. Note
> that the package containing implementation is NOT exported
> - A Java RouteBuilder that uses the Java interface via bean(...) DSL calls,
> with a setter for the bean implementing the interface
> - Wire everything together with Blueprint - create a <reference ...> for the
> service, a <bean ...> for the RouteBuilder and inject the service reference,
> and use the RouteBuilder in a CamelContext.
> After all this is deployed, stop the bundle implementing the service. A
> ServiceUnavailableException should be thrown after a timeout, but the object
> that was injected into the RouteBuilder process the request - so the
> Blueprint Proxy is not used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)