Are there specific configurations or setup that I must do for this?  I am
using ServiceMix 5.1.2.

"update-strategy" does not appear to be supported.  I get the following
error in the servicemix log:

11:00:00,171 | ERROR | mix-5.1.2/deploy | BlueprintContainerImpl
| 7 - org.apache.aries.blueprint.core - 1.4.0 | Unable to start blueprint
container for bundle ConfigTest
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable
to validate xml
<stack trace taken out for brevity>
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute
'update-strategy' is not allowed to appear in element
'cm:property-placeholder'.
<stack trace taken out for brevity>


When I change the xmlns to http://www.osgi.org/xmlns/blueprint/v1.1.0 I get
the following:

10:58:21,973 | INFO  | mix-5.1.2/deploy | BlueprintContainerImpl
| 7 - org.apache.aries.blueprint.core - 1.4.0 | Bundle ConfigTest is
waiting for namespace handlers [http://www.osgi.org/xmlns/blueprint/v1.1.0]


I used the following in my blueprint.xml file and Jetty stays bound to port
80 no matter what I change in the etc/my.config.cfg file.  ServiceMix does
log that a change to the config file has been made as well.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:camel="
http://camel.apache.org/schema/blueprint";
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/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";>

<cm:property-placeholder
persistent-id="my.config">
<cm:default-properties>
<cm:property name="port" value="9999" />
</cm:default-properties>
</cm:property-placeholder>

<camelContext id="blueprintContext" trace="false"
xmlns="http://camel.apache.org/schema/blueprint";>
<route id="jettyTesting">
<from uri="jetty:http://0.0.0.0:${port}/hello"; />
<to uri="log:OUTPUT" />
<camel:setBody><camel:constant>Hello World</camel:constant></camel:setBody>
</route>
</camelContext>

</blueprint>


On Thu, Oct 9, 2014 at 9:45 AM, Jean-Baptiste Onofré <[email protected]>
wrote:

> Yes, with the reload strategy, the config changes are taken on the fly.
>
> Regards
> JB
>
>
> On 10/09/2014 03:30 PM, Mark Webb wrote:
>
>> Thanks for the information all.  I have been messing with the example
>> Jean-Baptiste mentioned.  My one question on this approach is, is it
>> possible to change the config file and have the bundle auto-restart with
>> the new configuration info or do I always have to restart the bundle?  If
>> I
>> have to restart the bundle (which isn't a big deal), will all the objects
>> in the blueprint file get recreated since objects defined in the blueprint
>> are singleton in nature.
>>
>>
>>
>> On Thu, Oct 9, 2014 at 8:15 AM, Jean-Baptiste Onofré <[email protected]>
>> wrote:
>>
>>  Hi Mark,
>>>
>>> ConfigAdmin is probably the easiest.
>>>
>>> For instance, your blueprint can looks like:
>>>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>>>
>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";>
>>>
>>>    <cm:property-placeholder persistent-id="my.config"
>>> update-strategy="reload">
>>>      <cm:default-properties>
>>>         <cm:property name="port" value="9999"/>
>>>      </cm:default-properties>
>>>    </cm:property-placeholder>
>>>
>>>    <camelContext xmlns="http://camel.apache.org/schemas/blueprint";>
>>>       <route>
>>>         <from uri="jetty://0.0.0.0:${port}"/>
>>>         ....
>>>       </route>
>>>    </camelContext>
>>>
>>> </blueprint>
>>>
>>> You can provide a file etc/my.config.cfg containing the port value.
>>>
>>> Regards
>>> JB
>>>
>>>
>>> On 10/08/2014 08:16 PM, Mark Webb wrote:
>>>
>>>  I am building a camel blueprint-based bundle to deploy in ServiceMix.
>>>> This
>>>> bundle will listen on a port and receive data to be processed by other
>>>> bundles.  I would like to make the port and the destination (probably a
>>>> JMS
>>>> queue) configurable.  What is the best way to go about doing this?
>>>>
>>>> The site where the bundle(s) get deployed will not have a development
>>>> environment so that's out of the question.
>>>>
>>>> Thanks,
>>>> Mark
>>>>
>>>>
>>>>  --
>>> Jean-Baptiste Onofré
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>>
>>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Reply via email to