Help: Aries Blueprint handling of property-placeholder and substitution
blackard Jul 27, 2011 11:07 AMHi all,
I'm having trouble with configuration properties in Aries Blueprint.
I've converted a small test application from Spring to Blueprint, and have successfully gotten OSGi service bindings, Camel routes and even CXF JAX-RS working - the last required moving to ServiceMix-4.4.0-FUSE-00-43 since CXF didn't have Blueprint support until version 2.4. This, of course, involved moving my bundle context files out of , changing the namespaces, and making a few other adjustments.
All in all, that went pretty well. However, being a glutton for punishment I decided to add some configuration properties - I'm actually doing a proof of concept in preparation for work on the next release of a product I'm helping out with, and in addition to OSGi service bindings, Camel routes, and CXF producing JAX-RS RESTful interfaces, the current product uses configuration stuff.
The test application is pretty simple. There's a Common bundle that includes the model, common exceptions and service interface definitions, with the model being generated from an XSD using the XJC plugin. There's a Producer bundle that exposes three REST calls (ProducerRest.java) and has three methods (ProducerImpl.java), as well as an OSGi service and a Camel endpoint allowing the three methods to be accessed by REST, OSGi or Camel. Finally, there's a Consumer bundle that consumes the Produce bundle's OSGi and Camel endpoints. All this stuff works perfectly well. The only this that isn't behaving is configuration.
Basically, none of the value="${...}" substitutions are happening. After some experimentation, I finally decided to create a separate bundle with just a Camel route running off a timer to ping an interface that logs a string set by configuration property injection. I created the bundle by copying the Producer bundle, changing package and class names, removing the CXF/JAX-RS and OSGi service stuff.
I almost lost it when, after building this stand alone bundle, I deployed it and the configuration property substitutions worked.
When I deploy the stand alone version, I see the following log entries:
-
Retrieving property value msg.spit from configuration with pid org.none.proj.configPropTest
Property not found in configuration
Retrieving property msg.spit
Retrieved property msg.spit value from defaults Mamma tol' me not to.
Retrieving property value msg.sneeze from configuration with pid org.none.proj.configPropTest
Found property value A'choo!
-
Similar log entries do not appear associated with when I deploy Producer.
Both bundles have a file bundle-context.xml in the /OSGI-INF/blueprint directory that looks like this:
-
-
What is it that triggers processing of the property-placeholder goodies in a bundle, and what would cause one bundle to work and another to not work?
Edited by: blackard on Jul 27, 2011 3:03 PM
Edited by: blackard on Jul 27, 2011 3:05 PM