camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Johnson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9570) Blueprint Proxies are not used when injected into Java RouteBuilders
Date Thu, 26 May 2016 21:02:13 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15302924#comment-15302924
] 

Brad Johnson commented on CAMEL-9570:
-------------------------------------

I'm going to have to go back and recheck this.  At the time I ran into the
problem I'd started working with the Java route builder and the
annotations.  Usually I did everything in beans and XML.  After I ran into
the problem I started looking at the classloaders in Camel and posted a
concern that I had about the order and way classloaders were working.  It's
been awhile and I've been so focused on other technical issues the details
escape recall.

I switched back to using XML for routes and Java beans for all logic and
stopped using the route builder altogether.  I haven't seen the problem
since.  To make my code a bit more Java centric I started using a number of
smaller Camel routes inside the bundles and use @EndpointInject to inject
them into a connector class that I could use in my other Java classes.  But
I've avoided the Java DSL and route builder with blueprint since then.
Well, the other reason I stopped using the route builder is that I didn't
find it helped me interoperate with the Java classes themselves in any
really improved way and when I ran into some bean invocation errors on top
of it it started to feel a bit of a mess.

The hybrid approach of injecting endpoints into a small helper/wrapper
class that I use in my Java classes has worked well.  At least it limits
the casting to and from calls to routes to that one location.  And then I
can inject that into my other Java classes and they can simply call out to
whatever camel routes make sense in the context.  I use an interface on
that connector class so I can even mock it for testing of my Java classes
(though I haven't done that as much as I should <confession>).

I took a quick look at your code and if I get time later tonight I'll look
again.  Did the other bundle you have in their use Camel blueprint XML for
the routes.  In essence doing the same thing as the Java RouteBuilder but
only in blueprint XML?  I'll also have to see if I can find some of the
posts from back when I was wrestling with this same problem some time after
the first of the year.

Brad

On Thu, May 26, 2016 at 3:13 PM, Quinn Stevenson (JIRA) <jira@apache.org>



> 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)

Mime
View raw message