0 Replies Latest reply on Sep 22, 2016 3:51 PM by N Voskresenskiy

    How to correctly manage feature configuration deployment?

    N Voskresenskiy Newbie

      I am trying to evaluate JBoss Fuse as an integration platform, and I have the following question regarding deployment.

       

      I am trying to set up a fabric and use profiles, more specifically feature repositories for camel/blueprint component deployment.

      I am having the following issue with externalizing the component configuration: when i update the snapshot of the configuration file artifact, the configuration changes are not picked up by the container.

       

      Moreover, when i completely remove the profile from the container, the PID config file stays on the server in etc/ folder.

       

      Also there is an additional issue during deployment where the camel bundle gets activated before the config pid file is loaded, resulting in exception in aries blueprint, and i have to additionally refresh the osgi bundle manually.

       

      Here is how the feature repository file looks like:

      <?xml version="1.0" encoding="UTF-8"?>
      <features name="fuse-poc">
          <feature name="fuse-poc-common" version="${project.version}">
              <bundle>mvn:com.myorg.fuse/common/${project.version}</bundle>
          </feature>
          <feature name="fuse-poc-camel" version="${project.version}">
              <feature>fuse-poc-common</feature>
              <config name="com.myorg.fuse.poc.camel">
                  test.value=ENC(5XdDgfKwwhMTmbo1z874eQ==)
              </config>
              <bundle>mvn:com.myorg.fuse/fuse-poc-camel/${project.version}</bundle>
          </feature>
          <feature name="fuse-poc-activemq" version="${project.version}">
              <feature>fuse-poc-common</feature>
              <configfile finalname="etc/com.myorg.fuse.poc.jms.cfg">
                  mvn:com.myorg.fuse/feature/${project.version}/cfg/dev
              </configfile>
              <bundle>mvn:com.myorg.fuse/fuse-poc-camel-activemq/${project.version}</bundle>
          </feature>
      </features>
      

      The projects themselves are simple camel archetype projects with one having a basic route with logging and one with route using activemq and cm:property-placeholder in blueprint.xml

       

      Here is the corresponding build section in maven:

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
        <groupId>com.myorg.fuse</groupId>
        <artifactId>fuse-poc-parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        </parent>
        <artifactId>feature</artifactId>
        <packaging>pom</packaging>
      
      
        <name>FUSE PoC Feature Repository</name>
        <build>
              <resources>
                  <resource>
                      <directory>src/main/resources</directory>
                      <filtering>true</filtering>
                  </resource>
              </resources>
        <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-resources-plugin</artifactId>
                      <version>2.6</version>
                      <executions>
                          <execution>
                              <id>filter</id>
                              <phase>generate-resources</phase>
                              <goals>
                                  <goal>resources</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.10</version>
        <executions>
        <execution>
        <id>attach-artifacts</id>
        <phase>package</phase>
        <goals>
        <goal>attach-artifact</goal>
        </goals>
        <configuration>
        <artifacts>
        <artifact>
        <file>target/classes/fuse-poc.xml</file>
        <type>xml</type>
        <classifier>features</classifier>
        </artifact>
                                      <artifact>
                                          <file>src/main/resources/env/dev/com.myorg.fuse.poc.jms.cfg</file>
                                          <type>cfg</type>
                                          <classifier>dev</classifier>
                                      </artifact>
        </artifacts>
        </configuration>
        </execution>
        </executions>
        </plugin>
        </plugins>
        </build>
      </project>
      

      Here are the commands i deploy the feature

       

      fabric:version-create 1.1

      fabric:profile-create --parent jboss-fuse-full fuse-poc

      fabric:profile-edit --repository mvn:com.myorg.fuse/feature/1.0.0-SNAPSHOT/xml/features fuse-poc 1.1

       

      fabric:profile-edit --feature fuse-poc-camel fuse-poc 1.1

      fabric:profile-edit --feature fuse-poc-activemq fuse-poc 1.1

       

      fabric:container-upgrade 1.1 root

      fabric:container-add-profile root fuse-poc

       

      After i manually do osgi:refresh <bundle id> the bundle it starts fine.

       

      fabric:container-remove-profile root fuse-poc

       

      All the config pid entries stay in the config, and all osgi bundles are also staying installed. How do i correctly undeploy artifacts so that the container is clean and an updated version of the same artifact can be deployed without side effects?

       

      I suspect i am doing something conceptually wrong, because ultimately the issue above leads to the following problem: if i add a property to either the <config> element in features, or the .cfg file and install the project using maven again, and then do container-remove-profile, profile-refresh, and container-add-profile, the config does not change at all. It can only be redeployed correctly if i manually do the config:delete command on my pid in the console.