3 Replies Latest reply on Feb 19, 2014 2:53 AM by roybrumby

    Blueprint Bundle with Metatype deployment problem

    roybrumby

      Hi,

      I have a bundle containing a blueprint which just defines an AMQ broker connection with properties referenced via cm:property-placeholder.

      The values for these properties are defined in a metatype.xml.

       

      When I deploy (Fuse 6.0.0) the bundle it fails to start due to the properties not being resolved (the unparsed "${propName}"'s are used instead of the property values).

      The metatype property definitions are created (and are visible in the web console) exactly as expected.

      If I add cm:default-properties to my blueprint, the bundle deploys fine, but then it always uses the default values from the blueprint rather than the values defined in metatype.

       

      Once successfully deployed, I can then remove the cm:default-properties and redeploy & everything works as expected - but this is a workaround and means I have to add cm:default-properties, deploy, remove cm:default-properties and then deploy again. I guess another workaround would be to put the metatype definition in a separate bundle but that seems more work than should be necessary.

       

      How is this supposed to work? Is there a timing issue in the deployment process between metatype model deployment and the bundle? Or am I missing something (I also tried making activation lazy on all my beans to see if that would allow the metatype definition to be created first but it made no difference)?

       

      Thanks for your help!

      Roy

        • 1. Re: Blueprint Bundle with Metatype deployment problem
          minibiti

          Hi Roy,

           

           

          The way <cm:property-placeholder> works is that you define your properties and their default values in your xml file(s).

          If you want to override these default values for a given environment, you have to use a .cfg file that you deploy in $FUSE_HOME/etc.

          Its name has to be the persistent-id you chose followed by .cfg.

          Here is an example:

          <cm:property-placeholder persistent-id="my.properties" update-strategy="reload">
            <cm:default-properties>
              <cm:property name="errorhandler.internal.endpoint" value="direct-vm:error" />
            </cm:default-properties>
          </cm:property-placeholder>
          

           

          So now if you place a file called my.properties.cfg in $FUSE_HOME/etc, with the content below, it will override the value for your property:

          errorhandler.internal.endpoint=direct-vm:my-new-error-endpoint

           

           

          More info here: https://access.redhat.com/site/documentation/en-US/JBoss_Fuse/6.0/html/Deploying_into_the_Container/files/DeployCamel-Os…

           

           

          JM.

          • 2. Re: Blueprint Bundle with Metatype deployment problem
            roybrumby

            Thanks JM,

             

            But you are referring to using Config admin. In theory, I believe that meta type should work the same way - and it does after initial deployment. But my problem is that on initial deployment it seems like the meta type properties aren't available to the bundle. By adding default properties they become available but then editing their values doesn't make any difference until the default properties are removed and the bundle is redeployed.

             

            Roy

            • 3. Re: Blueprint Bundle with Metatype deployment problem
              roybrumby

              Ok, penny dropped! So when using meta type I still need to provide a file in etc to create the properties.

              Thanks

              Roy