Skip to content

Instantly share code, notes, and snippets.

@evacchi
Last active February 12, 2020 09:04
Show Gist options
  • Save evacchi/50ab8d5a60c3f247ee6b20af49db1c9a to your computer and use it in GitHub Desktop.
Save evacchi/50ab8d5a60c3f247ee6b20af49db1c9a to your computer and use it in GitHub Desktop.
Kogito Milano Hackaton

I have set up a repository https://github.com/evacchi/kogito-travel-agency-tutorial with yet-another fork of Maciej's demo. I have upgraded kogito and quarkus to the latest version.

You will try two versions of the tutorial; one will run completely on your local machine. The other can run locally, but it would be more interesting if you tried it on OpenShift.

01-kogito-travel-agency

try this demo.

 mvn compile quarkus:dev

then browse to localhost:8080

06-kogito-travel-agency + 06-kogito-visas

The goal for this is to try and get the "more complicated" examples to run on crc or minishift https://github.com/code-ready/crc https://github.com/minishift/minishift/releases

(crc is preferred but minishift may work if you have less disk space -- not sure if the operator will work though)

Follow the instructions here https://github.com/kiegroup/kogito-cloud-operator to install the examples and all the required services

Alternatively (local install)

@tarilabs
Copy link

Also VISA task:
image

does not sort any effect

@evacchi
Copy link
Author

evacchi commented Feb 11, 2020

all fixed in last revision

@danielezonca
Copy link

danielezonca commented Feb 11, 2020

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.acme.travel</groupId>
  <artifactId>kogito-travel-agency</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus-plugin.version>1.3.0.Alpha1</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.3.0.Alpha1</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-bom</artifactId>
      <version>${quarkus.platform.version}</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-kogito</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>drools-decisiontables</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-openapi</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemProperties>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemProperties>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>

@tkobayas
Copy link

Today (12th Feb), I cloned https://github.com/evacchi/kogito-travel-agency-tutorial and run 01-kogito-travel-agency.

After submitting a new trip, I get this error.

2020-02-12 15:46:34,699 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-17) HTTP Request to /travels failed, error id: 9ccaa260-ccb3-4c13-8283-810c1c82e928-1: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: org/acme/travels/rules/DomainClassesMetadataFE8EF1399D2AE143F92A08BF22DD8A07
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
	...
Caused by: java.lang.NoClassDefFoundError: org/acme/travels/rules/DomainClassesMetadataFE8EF1399D2AE143F92A08BF22DD8A07
	at org.acme.travels.rules.RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheckRuleMethods0.rule_Italian_32citizens_32do_32not_32require_32visa_32to_32US(RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheckRuleMethods0.java:20)
	at org.acme.travels.rules.RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheck.getRulesList(RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheck.java:36)
	at org.acme.travels.rules.RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheck.<init>(RulesFE8EF1399D2AE143F92A08BF22DD8A07_VisaCheck.java:42)
	at org.drools.project.model.ProjectModel.getModelsForKieBase(ProjectModel.java:22)
	at org.drools.project.model.ProjectRuntime.lambda$getKieBase$0(ProjectRuntime.java:21)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1133)
	at org.drools.project.model.ProjectRuntime.getKieBase(ProjectRuntime.java:21)
	at org.drools.project.model.ProjectRuntime.getKieBaseForSession(ProjectRuntime.java:47)
	at org.drools.project.model.ProjectRuntime.newKieSession(ProjectRuntime.java:36)
	at org.drools.project.model.ProjectRuntime.newKieSession(ProjectRuntime.java:31)
	at org.kie.kogito.rules.KieRuntimeBuilder.newKieSession(KieRuntimeBuilder.java:34)
	at org.acme.travels.rules.VisaCheckRuleUnit.createLegacySession(VisaCheckRuleUnit.java:24)
	at org.acme.travels.rules.VisaCheckRuleUnit.internalCreateInstance(VisaCheckRuleUnit.java:20)
	at org.acme.travels.rules.VisaCheckRuleUnit.internalCreateInstance(VisaCheckRuleUnit.java:7)
	at org.kie.kogito.rules.units.impl.AbstractRuleUnit.createInstance(AbstractRuleUnit.java:35)
	at org.kie.kogito.rules.RuleUnit.createInstance(RuleUnit.java:23)
	at org.jbpm.workflow.instance.node.RuleSetNodeInstance.internalTrigger(RuleSetNodeInstance.java:182)
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:200)
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:404)
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:389)
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:358)
	at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:75)
	at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:46)
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:200)
	at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:38)
	at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:235)
	at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:488)
	at org.jbpm.process.instance.LightProcessRuntime.startProcessInstance(LightProcessRuntime.java:155)
	at org.kie.kogito.process.impl.AbstractProcessInstance.start(AbstractProcessInstance.java:134)
	at org.kie.kogito.process.impl.AbstractProcessInstance.start(AbstractProcessInstance.java:120)
	at org.acme.travels.TravelsResource.lambda$createResource_travels$0(TravelsResource.java:58)
	at org.kie.kogito.services.uow.UnitOfWorkExecutor.executeInUnitOfWork(UnitOfWorkExecutor.java:33)
	at org.acme.travels.TravelsResource.createResource_travels(TravelsResource.java:52)
	at org.acme.travels.TravelsResource_ClientProxy.createResource_travels(TravelsResource_ClientProxy.zig:428)
	...
Caused by: java.lang.ClassNotFoundException: org.acme.travels.rules.DomainClassesMetadataFE8EF1399D2AE143F92A08BF22DD8A07
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:292)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:252)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:292)
	at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:252)
	... 77 more

I confirmed that DomainClassesMetadataFE8EF1399D2AE143F92A08BF22DD8A07.java exists under target/ but DomainClassesMetadataFE8EF1399D2AE143F92A08BF22DD8A07.class doesn't exist to it's not compiled.

After I go back to the previous commit (69e9eb7b23c11a8f02c2b5f0606f8ac481d4e8c8), the application worked. So upgrading to quarkus 1.3.0.Alpha1 seems to be the problem (commit 9ed8d2069d5642523ed2e0ff89cfed5ae7320b10). It might be related to https://issues.redhat.com/browse/KOGITO-1144 (already fixed in master drools-model-compiler).

@tkobayas
Copy link

Okay, after building drools-model-compiler 7.32.0.Final with the KOGITO-1144 fix, the application worked with 1.3.0.Alpha1.

@lucamolteni
Copy link

Here's what I found during the hackaton.

Validation

In the example there's no validation (nor client or server side).
Apparently there's no way to validate server side the input in the rest call, and invalid data are not printed to the logs in any way. We should probably study a way to do that.

Maven Wrapper

Maven wrapper is not working due to the lack of mvn wrapper jar. In my case the zsh mvn plugin triggered mvn wrapper automatically therefore making the example fail. I think we should provide a correct implementation of mvn wrapper or remove it.

Better instructions for installing vs code extensions

In the link provided, pointing to the github release page I didn't know what to do. @danielezonca told me to expand the artifacts
tab, download the .vsix file and install it manually. I think we should write these instructions somewhere.

BPMN editor

I found some quirks but they told the team already knows them:

  • Undo is not working
  • The tool is not autosaving not signaling whether the file is saved or no.

@evacchi
Copy link
Author

evacchi commented Feb 12, 2020

@lucamolteni

In the link provided, pointing to the github release page I didn't know what to do.

Do not disagree with anything, just wanted to point out that in this gist there is also a curl|sh way for installing -- I think this is a good way to make it easy to install while still keeping it out of the marketplace

@evacchi
Copy link
Author

evacchi commented Feb 12, 2020

( although I just realized that the URL was not pointing to the right version, this is http://bit.ly/kogito-ext )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment