David, (for some reason Google was filtering your email address from yahoo
as a phishing attack)
I agree and think that DS and the SCR are great for exposing and importing
services. In Blueprint I'd use the normal service/reference mechanics in
XML for that but can easily jettison it. But most of the work I do isn't
involved with inter-bundle service communication. And even there the
communications can be via Camel endpoints. The OSGi services I use are
usually for true cross-cutting concerns that wouldn't be remote.
But Camel SCR simply doesn't have a way to use any internal wiring of beans
and routes. Even when I do expose services via the OSGi registry it might
be for transforming canonical models into specific forms and back again.
So I need to load up Dozer mapping, get a method call, route to the
transform and send the results back with validators and exception handlers
and logging interceptors all along those internal routes. To the outside
user they are just calling an interface method of FooInventory
convert(InventoryCanonical model) and all the dependencies, mappings, etc.
remain encapsulated in the bundle that exports that interface. But there's
a lot of internal wiring. And that's a relatively simple example.
But Camel SCR doesn't make that really available.
On Mon, Aug 1, 2016 at 7:22 PM, David Jencks wrote:
> if the declared DS services are non-exported classes in the bundle then
> even though it gets in the service registry it won’t be accessible outside
> the bundle.
> You can also use a non-feature subsystem to restrict visibility to the
> service, but that starts getting complicated pretty rapidly.
> If you are even more ambitions you can use the Region api that is used in
> back of the subsystem implementation or if you are foolhardy you can use
> framework service hooks for the same purpose.
>
> However…. DS is not really intended to be a universal wiring framework for
> everything. It’s intended to provide a really good way to set up
> configured OSGI services. Once you start wanting private components I
> start wondering if the component is actually appropriate to be exposed as a
> service.
>
> I would be interested in seeing something like this in xml form with an
> indication of what kind of wiring variability is needed or useful. I’d
> like to understand how much independent configuration there is, how it
> would be most logically grouped, and how much the wiring could just as well
> be written in java. I’m wondering about an approach of having basically
> one DS component that gets the configuration(s) and wires up the other
> components somehow.
>
> thanks
> david jencks
>
> On Aug 1, 2016, at 4:33 PM, Matt Sicker wrote:
>
> Can you even make a semi-private service in DS/SCR? What could the
> equivalent be to a blueprint bean that isn't exported as a service? Or is
> the philosophy to make all services public in DS?
>
> On 1 August 2016 at 18:12, Brad Johnson
> wrote:
>
>> Tim,
>>
>> After working with DS and SCR a little I can understand its benefits.
>> One obvious advantage was being able to write basic JUnit tests to test my
>> routes without having to fire up CBTS. I've always disliked working in XML
>> so it is odd being in the position like I sound like I'm the one
>> championing it.
>>
>> The main problem right now with Camel is that while SCR handles all the
>> external items there isn't a way to do any injection of "local"
>> dependencies. By that I mean within my own bundle I might have validators,
>> handlers, local data models, etc. that I want to stand up and run in my
>> Camel routes. Camel SCR doesn't have a mechanism for doing that.
>>
>> When one runs it locally in the IDE it fires up a SimpleRegistry and uses
>> that to register everything and in that case you can manually add your own
>> beans before setting up route definitions. If the bundle is running where
>> it has a bundle context it instead fires up an OsgiServiceRegistry(don't
>> recall the full name.) In that case you can't add your local beans.
>>
>> I noted that there is a CompositeRegistry in the AbstractCamelRunner and
>> perhaps that should always be the one used. If one boots up and an OSGi
>> service registry is created both it and the SimpleRegistry are added to the
>> CompositeRegistry but one can access the SimpleRegistry in order to add
>> one's local dependencies for Camel routes.
>>
>> On Wed, Jul 13, 2016 at 3:34 AM, Timothy Ward
>> wrote:
>>
>>> Hi Brad,
>>>
>>> I’ve been watching this thread for a while, and you’ve finally managed
>>> to draw me in :)
>>>
>>>
>>> On 12 Jul 2016, at 17:42, Brad Johnson
>>> wrote:
>>>
>>> Guillaume,
>>>
>>> I'm still using Blueprint and have found Camel/SCR to be a pain to work
>>> with. It provides no tangible benefit if one is using Blueprint for routes
>>> and dependency injection anyway as it