Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-9178

Immutable SpringBoot Deployment

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 7.43.0.Final
    • None
    • KieServer, SpringBoot
    • None
    • 2020 Week 22-24 (from May 25), 2020 Week 25-27 (from Jun 15), 2020 Week 28-30 (from Jul 6), 2020 Week 31-33 (from Jul 27), 2020 Week 34-36 (from Aug 17)

      It has been created a new immutable spring boot container allowing spring boot app contain the artifacts to be resolved within jar. This removes the need of the offliner tools as they are resolved at maven packaging time. The system allows multiple versions of the same kjar (including modules). They are separated from the BOOT-INF/lib jars to avoid class loader collissions and each class path container kjar is isolated from each other not relying in spring boot class loader.

      to achieve it is required 3 steps.

      add this in the spring boot properties:

      kieserver.classPathContainer=true
      

      specifying the containers to be deployed

      @Configuration
      public class KieContainerDeployer {
      
          @Bean
          public KieContainerResource evaluation_v1() {
              KieContainerResource container = new KieContainerResource("evaluation_v1", new ReleaseId("com.myspace", "Evaluation", "1.0.0-SNAPSHOT"), STARTED);
              container.setConfigItems(Arrays.asList(new KieServerConfigItem(KieServerConstants.PCFG_RUNTIME_STRATEGY, "PER_PROCESS_INSTANCE", "String")));
              return container;
          }
      
          @Bean
          public KieContainerResource evaluation_v2() {
              KieContainerResource container = new KieContainerResource("evaluation_v2", new ReleaseId("com.myspace", "Evaluation", "2.0.0-SNAPSHOT"), STARTED);
              container.setConfigItems(Arrays.asList(new KieServerConfigItem(KieServerConstants.PCFG_RUNTIME_STRATEGY, "PER_PROCESS_INSTANCE", "String")));
              return container;
          }
      
      }
      

      With this won't be needed to specify any property. just include the deployments within spring boot as the next bullet indicates. This will deploy
      automatically those with a container id <artifactId>-<version>

      Maven plugin in the service (including kjar multiple version). This will resolve the necesary artifacts to run the kjar.

        <build>
          <plugins>
            <plugin>
              <groupId>org.kie</groupId>
              <artifactId>kie-maven-plugin</artifactId>
              <version>${version.org.kie}</version>
              <executions>
                <execution>
                  <id>copy</id>
                  <phase>prepare-package</phase>
                  <goals>
                    <goal>package-dependencies-kjar</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <artifactItems>
                  <artifactItem>
                    <groupId>com.myspace</groupId>
                    <artifactId>Evaluation</artifactId>
                    <version>1.0.0-SNAPSHOT</version>
                  </artifactItem>
                  <artifactItem>
                    <groupId>com.myspace</groupId>
                    <artifactId>Evaluation</artifactId>
                    <version>2.0.0-SNAPSHOT</version>
                  </artifactItem>
                </artifactItems>
              </configuration>
            </plugin>
          <plugins>
        <build>
      

              elguardian@gmail.com Enrique González Martínez (Inactive)
              elguardian@gmail.com Enrique González Martínez (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: