[
https://issues.apache.org/jira/browse/CAMEL-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15143645#comment-15143645
]
Richard Davidson commented on CAMEL-9570:
-----------------------------------------
I have been looking into this issue for a while this evening and can't figure
it out. It is unrelated to the service being cached in the OsiServiceRegistry
as described in
http://camel.465427.n5.nabble.com/OsgiServiceRegistry-caching-service-references-why-td5777410.html.
I can't recreate the issue when using a route builder, but from my
investigations I don't get the issue when I use java DSL and inject the
CamelContext manually via blueprint into a bean and call
camelContext.addRoutes(new RouteBuilder(....)). For example I get the
.ServiceUnavailableException and the correct behaviour with:
{code}
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
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">
<reference id="echo-service" interface="com.rdavidson.camel.test.Hello"
timeout="2000" />
<bean id="very-simple-route-builder"
class="com.rdavidson.osgi.consumer.VerySimpleBuilder" init-method="start">
<property name="blueprintServiceReference" ref="echo-service" />
<property name="camelContext" ref="very-simple-context"/>
</bean>
<camelContext id="very-simple-context"
xmlns="http://camel.apache.org/schema/blueprint">
</camelContext>
</blueprint>
public class VerySimpleBuilder extends RouteBuilder {
private Hello blueprintServiceReference;
private CamelContext camelContext;
public void setBlueprintServiceReference(Hello
blueprintServiceReference) {
this.blueprintServiceReference = blueprintServiceReference;
}
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
}
public void configure() throws Exception {
from("timer://very-simple-builder?period=5000").bean(blueprintServiceReference);
}
public void start() throws Exception{
camelContext.addRoutes(this);
}
}
{code}
> 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)