7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Business Automation Manager Open Edition メモ - (7) kogitoでのルール開発(スタンドアローン)

Last updated at Posted at 2023-01-04

はじめに

当記事では、Kogitoというルールサーバー上でルールを動かす手順を確認してみます。
Kogitoはクラウド・ネイティブの考え方でビジネス・ルールを実行するための機能を提供するOSSです。BAMOEにはKogitoをベースとしたルールサーバー機能も提供しています(つまりKogitoの有償版)。KogitoはJavaのフレームワークであるQuarkusもしくはSpring Boot上で稼働します。ここではBAMOE提供のKogitoをQuarkusを使用して動かす方法を試してみます。

関連記事

Business Automation Manager Open Edition メモ - (1) 概要
Business Automation Manager Open Edition メモ - (2) KIE Server, Business Central 構成
Business Automation Manager Open Edition メモ - (3) Business Centralを使用したルール開発
Business Automation Manager Open Edition メモ - (4) KIEサーバー上のルール呼び出し
Business Automation Manager Open Edition メモ - (5) Embedded形態でのルール開発(DRL編)
Business Automation Manager Open Edition メモ - (6) Embedded形態でのルール開発(DMN編)
Business Automation Manager Open Edition メモ - (7) kogitoでのルール開発(スタンドアローン)
Business Automation Manager Open Edition メモ - (8) kogitoでのルール開発(OpenShiftへのデプロイ)

全体像

image.png

今回、QuarkusをベースとしてKogitoを稼働させる想定です。つまりQuarkusアプリケーションとしてKogitoを動かすイメージになります。Mavenを使用したQuarkusアプリケーション開発の基本的な考え方は以下が参考になります。
Quarkus - Maven を使ったアプリケーションの構築

Kogitoはマイクロサービスアーキテクチャーのスタイルでルールを稼働させることを想定したルールエンジンです。実際にはKubernetesやOpenShift上のコンテナとして実行することが想定されますが、ここではコンテナ化はせずに単純にJVM上で稼働させるところまでの流れを確認します。

環境情報

VS CodeにWSLのExtensionを入れてWSL上のプロジェクトをハンドリングできるようにしておきます。
VS CodeはWindows上にインストールされているものを使用し、WSL(Ubuntu)上でプロジェクトを管理して動かすイメージです。

Windows11
VS Code 1.73.1

WSL - Ubuntu 20.04 LTS (Focal Fossa)
openJDK 11.0.16
Maven 3.6.3

user01@IBM-PF3ALW3Q:~$ java -version
openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

user01@IBM-PF3ALW3Q:~$ mvn -v
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.16, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.10.102.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

参考:
Linux 用 Windows サブシステムで Visual Studio Code の使用を開始する
WSL extension

※ここではWindows11+WSL環境での実行を試していますが、IBM BAM OE V8.0.1としてサポートしているOSはRHEL8, WindowsServer2016のみです。
参考: System Requirements for IBM Business Automation Manager Open Editions 8.0.1
WSL(Ubuntu)でも動くだろうということで試しているものですのでご注意ください。また、droolsやkogitoなどオープンソースのプロジェクトでは基本的にRHELをベースに開発、テストが実施されているとのことで、Windows環境で実行する場合Windows固有の問題が発生することが多々あるようです。特に日本語を扱う必要がある場合はWindowsだと問題が起きやすいので今回はWSLで試しています。

サンプル実行

まず、提供されているサンプルを動かしてみて流れを確認してみます。
基本的には以下に示されている手順に従ってやってみます。
Learning IBM Business Automation Open Edition - Getting Started with Kogito

事前準備

ワークスペース作成

WSL上にVS Codeのワークスペースを作成しておきます。

settings.xmlファイル作成

mavenの設定ファイル(settings.xml)を作成しておきます。デフォルトでは使用ユーザーのホームディレクトリ下の.m2ディレクトリ下のsettings.xmlが参照されるのでそこに作成します(例: /home/user01/.m2/settings.xml)。
中身は以下に示されているサンプルをそのまま記述します。
Learning IBM Business Automation Open Edition - 2. Environment Setup - 2.2 Git, Maven and Java - 2.2.2 Maven

settings.xml
/home/user01/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>${user.home}/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline>false</offline>
  <profiles>
    <!-- Profile with online repositories required by IBAMOE -->
    <profile>
      <id>brms-bpms-online-profile</id>
      <repositories>
        <repository>
        <!-- Red Hat Maven Repository-->
          <id>jboss-ga-repository</id>
          <url>https://maven.repository.redhat.com/ga/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>jboss-ga-plugin-repository</id>
          <url>https://maven.repository.redhat.com/ga/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <id>maven-https</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
        <!--Maven Central Repository-->
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!-- Activation of the BRMS/BPMS profile -->
    <activeProfile>brms-bpms-online-profile</activeProfile>
    <activeProfile>maven-https</activeProfile>
  </activeProfiles>
</settings>

この設定の中でMaven RepositoryとしてRedHat提供のRepository: https://maven.repository.redhat.com/ga/ が追加指定されています。

※補足
依存関係のあるモジュールは https://maven.repository.redhat.com/ga/ に提供されていますので、リポジトリの定義を追加しています。(2022年11月点ではリポジトリとしてはRedHatさんが提供しているものしか無いようなのでそちらを使います。この時点ではIBMさんは別のリポジトリを立ててはいないようで、モノは同じということでRedHatさんのリポジトリを使えばよいようです。)

With IBM Business Automation Open Edition 8.0, the components are built around a Maven architecture predominantly. What this ultimately means is your workstation needs to be able to communicate with one to many different Maven Repositories. These labs will use two in particular, the Red Hat General Availability repository and Maven Central. You could easily replace the two repositories with a local environment one hosting the Maven dependencies as a mirror or based in a disconnected installation, but this is the easiest developer workflow for acquiring new dependencies. The reason we are pointing to the Red Hat Maven repository, at least in the short term, is that the builds for IBM Business Automation Open Edition 8.0 are being deployed there as they are the same binaries used within both the IBM and Red Hat products during the transition of Red Hat Process Automation Manager (RHPAM)/Red Hat Decision Manager (RHDM) from Red Hat into IBM Automation under the name of IBM Business Automation Open Edition 8.0 ( IBAMOE).

Mavenプロジェクト作成

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2$ mvn io.quarkus:quarkus-maven-plugin:create -DprojectGroupId=com.ibm.sample -DprojectArtifactId=quick-kogito -DprojectVersion=1.0.0-SNAPSHOT -Dextensions=kogito-quarkus,dmn,resteasy-reactive-jackson,quarkus-smallrye-openapi,quarkus-smallrye-health
[INFO] Scanning for projects...
Downloading from jboss-ga-plugin-repository: https://maven.repository.redhat.com/ga/io/quarkus/quarkus-maven-plugin/maven-metadata.xml
Downloading from central: https://repo1.maven.org/maven2/io/quarkus/quarkus-maven-plugin/maven-metadata.xml
Downloaded from central: https://repo1.maven.org/maven2/io/quarkus/quarkus-maven-plugin/maven-metadata.xml (7.5 kB at 8.5 kB/s)
Downloaded from jboss-ga-plugin-repository: https://maven.repository.redhat.com/ga/io/quarkus/quarkus-maven-plugin/maven-metadata.xml (1.2 kB at 686 B/s)

...

Downloaded from jboss-ga-plugin-repository: https://maven.repository.redhat.com/ga/com/google/guava/failureaccess/1.0.1.redhat-00003/failureaccess-1.0.1.redhat-00003.jar (5.0 kB at 1.5 kB/s)
Downloaded from jboss-ga-plugin-repository: https://maven.repository.redhat.com/ga/org/codehaus/plexus/plexus-utils/3.3.0.redhat-00001/plexus-utils-3.3.0.redhat-00001.jar (262 kB at 76 kB/s)
[INFO] Looking for the newly published extensions in registry.quarkus.io
[INFO] -----------
[INFO] selected extensions:
- org.kie.kogito:kogito-quarkus-decisions
- io.quarkus:quarkus-smallrye-openapi
- io.quarkus:quarkus-smallrye-health
- io.quarkus:quarkus-resteasy-reactive-jackson
- org.kie.kogito:kogito-quarkus

[INFO]
applying codestarts...
[INFO] 📚  java
🔨  maven
📦  quarkus
📝  config-properties
🔧  dockerfiles
🔧  maven-wrapper
🚀  kogito-dmn-codestart
🚀  resteasy-reactive-codestart
🚀  smallrye-health-codestart
[INFO]
-----------
[SUCCESS] ✅  quarkus project has been successfully generated in:
--> /home/user01/BAMOE_kogito2/quick-kogito
-----------
[INFO]
[INFO] ========================================================================================
[INFO] Your new application has been created in /home/user01/BAMOE_kogito2/quick-kogito
[INFO] Navigate into this directory and launch your application with mvn quarkus:dev
[INFO] Your application will be accessible on http://localhost:8080
[INFO] ========================================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:02 min
[INFO] Finished at: 2022-12-15T19:50:29+09:00
[INFO] ------------------------------------------------------------------------

※補足
extensionとしてdmnを指定することで、以下に示されるサンプルがインポートされるようです。
参考:
アプリケーションにディシジョン・オートメーション機能を追加するためのKogito DMNサポートの使用
GitHub - quarkusio/quarkus-quickstarts/kogito-dmn-quickstart/

作成されたディレクトリ下の構造は以下の通りです。

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2$ tree quick-kogito/
quick-kogito/
├── README.md
├── mvnw
├── mvnw.cmd
├── pom.xml
├── src
│   ├── main
│   │   ├── docker
│   │   │   ├── Dockerfile.jvm
│   │   │   ├── Dockerfile.legacy-jar
│   │   │   ├── Dockerfile.native
│   │   │   └── Dockerfile.native-micro
│   │   ├── java
│   │   │   └── com
│   │   │       └── ibm
│   │   │           └── sample
│   │   │               ├── GreetingResource.java
│   │   │               └── MyLivenessCheck.java
│   │   └── resources
│   │       ├── META-INF
│   │       │   └── resources
│   │       │       └── index.html
│   │       ├── application.properties
│   │       └── pricing.dmn
│   └── test
│       └── java
│           └── com
│               └── ibm
│                   └── sample
│                       ├── GreetingResourceIT.java
│                       ├── GreetingResourceTest.java
│                       └── PricingTest.java
└── target
    ├── classes
    │   ├── META-INF
    │   │   └── resources
    │   │       └── index.html
    │   ├── application.properties
    │   ├── com
    │   │   └── ibm
    │   │       └── sample
    │   │           ├── GreetingResource.class
    │   │           └── MyLivenessCheck.class
    │   └── pricing.dmn
    └── test-classes
        └── com
            └── ibm
                └── sample
                    ├── GreetingResourceIT.class
                    ├── GreetingResourceTest.class
                    └── PricingTest.class

26 directories, 24 files

作成したディレクトリをVS Codeのワークスペースに追加します。

image.png

image.png

サンプルDMNの確認

サンプルのルールの中身を確認しておきます。

pricing.dmnを開くと以下のポップアップが出るので「はい」をクリック
image.png

DMNファイル全体のプロパティ
image.png

入力データ1: Age
image.png

入力データ2: Previous incidents?
image.png

Decision: Base price
image.png

application.properties編集

デフォルトだとkogitoがListenするポートは8080が使われます。ポート番号を変更したい場合はsrc/main/resources/application.propertiesファイルに以下のように設定します(8085番ポートを使用する例)。

application.properties
quarkus.http.port=8085

kogito起動(development mode)

development modeでkogitoを起動してみます。

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2/quick-kogito$ mvn quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.ibm.sample:quick-kogito >---------------------
[INFO] Building quick-kogito 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.15.0.Final:dev (default-cli) @ quick-kogito ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:resources @ quick-kogito
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.15.0.Final:generate-code @ quick-kogito
Downloading from central: https://repo1.maven.org/maven2/com/ibm/sample/quick-kogito/1.0.0-SNAPSHOT/maven-metadata.xml
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile @ quick-kogito
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/user01/BAMOE_kogito2/quick-kogito/target/classes
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources @ quick-kogito
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/user01/BAMOE_kogito2/quick-kogito/src/test/resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.15.0.Final:generate-code-tests @ quick-kogito
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile @ quick-kogito
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/user01/BAMOE_kogito2/quick-kogito/target/test-classes
Listening for transport dt_socket at address: 5005
2022-12-15 19:55:29,712 INFO  [org.kie.kog.cod.api.uti.AddonsConfigDiscovery] (build-73) Performed addonsConfig discovery, found: AddonsConfig{usePersistence=false, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false}
2022-12-15 19:55:29,786 INFO  [org.kie.kog.cod.cor.uti.ApplicationGeneratorDiscovery] (build-79) Generator discovery performed, found [processes, rules, decisions, predictions]
2022-12-15 19:55:29,787 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-79) Skipping generator 'processes' because disabled
2022-12-15 19:55:29,789 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-79) Skipping generator 'predictions' because disabled
2022-12-15 19:55:29,814 INFO  [org.tes.doc.DockerMachineClientProviderStrategy] (build-28) docker-machine executable was not found on PATH ([/opt/gradle/gradle-7.5.1/bin, /home/user01/UtilCli, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games, /usr/lib/wsl/lib, /mnt/c/x/openjdk11/bin, /mnt/c/x/Java/jdk1.8.0_144/bin, /mnt/c/Program Files/Semeru/jre-8.0.332.9-openj9/bin, /mnt/c/Program Files/Semeru/jre-11.0.15.10-openj9/bin, /mnt/c/Python310/Scripts/, /mnt/c/Python310/, /mnt/c/WINDOWS/system32, /mnt/c/WINDOWS, /mnt/c/WINDOWS/System32/Wbem, /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/, /mnt/c/WINDOWS/System32/OpenSSH/, /mnt/c/Program Files/IBM/Trace Facility, /mnt/c/Program Files/IBM/Personal Communications/, /mnt/c/Program Files/nodejs/, /mnt/c/ProgramData/chocolatey/bin, /mnt/c/x/MinGW/bin, /mnt/c/x/MinGW/msys/1.0/bin, /mnt/c/x/ctg/bin, /mnt/c/Program Files/ibm/gsk8/lib64, /mnt/c/Program Files (x86)/ibm/gsk8/lib, /mnt/c/x/IBM/SQLLIB/BIN, /mnt/c/x/IBM/SQLLIB/FUNCTION, /mnt/c/x/IBM/SQLLIB/SAMPLES/REPL, /mnt/c/y/Tool/bin, /mnt/c/x/apache-maven-3.8.6/bin, /mnt/c/x/Git/cmd, /mnt/c/Users/A00527JP6/AppData/Local/Microsoft/WindowsApps, /mnt/c/Users/A00527JP6/AppData/Roaming/npm, /mnt/c/x/VSCode/bin, /mnt/c/Program Files/IBM/Cloud/bin, /mnt/c/Users/A00527JP6/AppData/Local/Box/Box Edit/, /snap/bin])
2022-12-15 19:55:29,816 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-28) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
        UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)As no valid configuration was found, execution cannot continue.
See https://www.testcontainers.org/on_failure.html for more details.

2022-12-15 19:55:29,846 INFO  [org.kie.kog.cod.rul.RuleCodegen] (build-79) No rule unit is present: generate KieRuntimeBuilder implementation.
2022-12-15 19:55:30,552 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-79) Initializing DMN DT Validator...
2022-12-15 19:55:30,553 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-79) DMN DT Validator initialized.
2022-12-15 19:55:30,553 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-79) Analysing decision tables in DMN Model 'pricing' ...
2022-12-15 19:55:30,563 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-79)  analysis for decision table 'Base price':
2022-12-15 19:55:30,565 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-79)   Decision Table Analysis of table 'Base price' finished with no messages to be reported.
2022-12-15 19:55:30,674 INFO  [org.kie.kog.qua.com.dep.KogitoAssetsProcessor] (build-73) reflectiveEfestoGeneratedClassBuildItem org.kie.kogito.quarkus.common.deployment.KogitoGeneratedSourcesBuildItem@24cc1ab4
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-12-15 19:55:32,477 INFO  [io.quarkus] (Quarkus Main Thread) quick-kogito 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 3.354s. Listening on: http://0.0.0.0:8085

2022-12-15 19:55:32,478 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-12-15 19:55:32,478 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, smallrye-openapi, swagger-ui, vertx]

--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>

ブラウザからKogitoへのアクセス

Development modeでは、開発時に便利な機能がいろいろと使えるようになっているようです。例えばブラウザからQuarkus applicationとしての情報を確認するための画面を表示させることができます。

http://localhost:8085/にアクセス
image.png

SwaggerUIからRESTによるルール呼び出し

SwaggerUIを用いてRESTによるルール呼び出しを試すこともできます。

前の画面の「VISIT THE DEV UI」をクリック
Swagger UIをクリック
image.png

POST /pricingを展開して「Try it out」をクリック
image.png

Ageに20, Previous incident?にfalseを指定してExecute
image.png

設定されたルールに基づき、Base priceとして800が返されました。
image.png

新規プロジェクト作成

提供されているサンプルを動かすことができたので、新規にプロジェクトを作成しルール開発から実行までの流れを確認していきます。

事前準備

上で作成したワークスペース、settings.xmlはそのまま使います。

Mavenプロジェクト作成

参考: Kogito を使用してアプリケーションにビジネスオートメーションの機能を追加する

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2$ mvn io.quarkus:quarkus-maven-plugin:create -DprojectGroupId=com.ibm.sample -DprojectArtifactId=kogito-test01 -DprojectVersion=1.0.0-SNAPSHOT -Dextensions=kogito-quarkus,resteasy-reactive-jackson,quarkus-smallrye-openapi,quarkus-smallrye-health
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.13.5.Final-redhat-00003:create (default-cli) @ standalone-pom ---
[INFO] -----------
[INFO] selected extensions:
- io.quarkus:quarkus-smallrye-openapi
- io.quarkus:quarkus-smallrye-health
- io.quarkus:quarkus-resteasy-reactive-jackson
- org.kie.kogito:kogito-quarkus

[INFO]
applying codestarts...
[INFO] 📚  java
🔨  maven
📦  quarkus
📝  config-properties
🔧  dockerfiles
🔧  maven-wrapper
🚀  resteasy-reactive-codestart
🚀  smallrye-health-codestart
[INFO]
-----------
[SUCCESS] ✅  quarkus project has been successfully generated in:
--> /home/user01/BAMOE_kogito2/kogito-test01
-----------
[INFO]
[INFO] ========================================================================================
[INFO] Your new application has been created in /home/user01/BAMOE_kogito2/kogito-test01
[INFO] Navigate into this directory and launch your application with mvn quarkus:dev
[INFO] Your application will be accessible on http://localhost:8080
[INFO] ========================================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.004 s
[INFO] Finished at: 2022-12-15T20:10:10+09:00
[INFO] ------------------------------------------------------------------------

※補足
artifactIdとしてkogito-test01を指定してプロジェクトを作成しています。また、extensionとしてはkogito-quarkus,resteasy-reactive-jackson,quarkus-smallrye-openapi,quarkus-smallrye-healthを指定しています(dmnははずしています)。

作成されたディレクトリ構造は以下の通りです。

user01@IBM-PF3ALW3Q:~/BAMOE_kogito$ tree kogito-test01/
kogito-test01/
├── README.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
    ├── main
    │   ├── docker
    │   │   ├── Dockerfile.jvm
    │   │   ├── Dockerfile.legacy-jar
    │   │   ├── Dockerfile.native
    │   │   └── Dockerfile.native-micro
    │   ├── java
    │   │   └── com
    │   │       └── ibm
    │   │           └── sample
    │   │               ├── GreetingResource.java
    │   │               └── MyLivenessCheck.java
    │   └── resources
    │       ├── META-INF
    │       │   └── resources
    │       │       └── index.html
    │       └── application.properties
    └── test
        └── java
            └── com
                └── ibm
                    └── sample
                        ├── GreetingResourceIT.java
                        └── GreetingResourceTest.java

15 directories, 14 files

このディレクトリをVS Codeのワークスペースに追加

DMNによるルール作成

以前の記事と同様にDMNにてルールを作成していきます。
(手順はそちらの記事もご参照ください)

ルールファイル作成

src/main/resources/以下にCustomerLoyalty.dmnというファイルを作成します。

image.png

データタイプ作成

以下のようなデータタイプを作成します。
image.png

入力データの配置

image.png

DMNディシジョンの配置

image.png

入力データとディシジョンの接続

image.png

ディシジョンの定義

image.png

その他の設定

image.png

application.properties編集

デフォルトだとkogitoがListenするポートは8080が使われます。ポート番号を変更したい場合はsrc/main/resources/application.propertiesファイルに以下のように設定します(8085番ポートを使用する例)。

application.properties
quarkus.http.port=8085

kogito起動 (development mode)

development modeでkogitoを起動してみます。

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2$ cd kogito-test01/
user01@IBM-PF3ALW3Q:~/BAMOE_kogito2/kogito-test01$ ls
README.md  mvnw  mvnw.cmd  pom.xml  src  target
user01@IBM-PF3ALW3Q:~/BAMOE_kogito2/kogito-test01$ mvn quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.ibm.sample:kogito-test01 >--------------------
[INFO] Building kogito-test01 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.15.0.Final:dev (default-cli) @ kogito-test01 ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:resources @ kogito-test01
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.15.0.Final:generate-code @ kogito-test01
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile @ kogito-test01
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/user01/BAMOE_kogito2/kogito-test01/target/classes
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources @ kogito-test01
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/user01/BAMOE_kogito2/kogito-test01/src/test/resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.15.0.Final:generate-code-tests @ kogito-test01
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile @ kogito-test01
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/user01/BAMOE_kogito2/kogito-test01/target/test-classes
Listening for transport dt_socket at address: 5005
2022-12-15 20:13:20,133 INFO  [org.kie.kog.cod.api.uti.AddonsConfigDiscovery] (build-8) Performed addonsConfig discovery, found: AddonsConfig{usePersistence=false, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false}
2022-12-15 20:13:20,235 INFO  [org.kie.kog.cod.cor.uti.ApplicationGeneratorDiscovery] (build-25) Generator discovery performed, found [processes, rules, decisions, predictions]
2022-12-15 20:13:20,237 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-25) Skipping generator 'processes' because disabled
2022-12-15 20:13:20,238 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-25) Skipping generator 'predictions' because disabled
2022-12-15 20:13:20,255 INFO  [org.tes.doc.DockerMachineClientProviderStrategy] (build-64) docker-machine executable was not found on PATH ([/opt/gradle/gradle-7.5.1/bin, /home/user01/UtilCli, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games, /usr/lib/wsl/lib, /mnt/c/x/openjdk11/bin, /mnt/c/x/Java/jdk1.8.0_144/bin, /mnt/c/Program Files/Semeru/jre-8.0.332.9-openj9/bin, /mnt/c/Program Files/Semeru/jre-11.0.15.10-openj9/bin, /mnt/c/Python310/Scripts/, /mnt/c/Python310/, /mnt/c/WINDOWS/system32, /mnt/c/WINDOWS, /mnt/c/WINDOWS/System32/Wbem, /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/, /mnt/c/WINDOWS/System32/OpenSSH/, /mnt/c/Program Files/IBM/Trace Facility, /mnt/c/Program Files/IBM/Personal Communications/, /mnt/c/Program Files/nodejs/, /mnt/c/ProgramData/chocolatey/bin, /mnt/c/x/MinGW/bin, /mnt/c/x/MinGW/msys/1.0/bin, /mnt/c/x/ctg/bin, /mnt/c/Program Files/ibm/gsk8/lib64, /mnt/c/Program Files (x86)/ibm/gsk8/lib, /mnt/c/x/IBM/SQLLIB/BIN, /mnt/c/x/IBM/SQLLIB/FUNCTION, /mnt/c/x/IBM/SQLLIB/SAMPLES/REPL, /mnt/c/y/Tool/bin, /mnt/c/x/apache-maven-3.8.6/bin, /mnt/c/x/Git/cmd, /mnt/c/Users/A00527JP6/AppData/Local/Microsoft/WindowsApps, /mnt/c/Users/A00527JP6/AppData/Roaming/npm, /mnt/c/x/VSCode/bin, /mnt/c/Program Files/IBM/Cloud/bin, /mnt/c/Users/A00527JP6/AppData/Local/Box/Box Edit/, /snap/bin])
2022-12-15 20:13:20,258 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-64) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
        UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)As no valid configuration was found, execution cannot continue.
See https://www.testcontainers.org/on_failure.html for more details.

2022-12-15 20:13:20,317 INFO  [org.kie.kog.cod.rul.RuleCodegen] (build-25) No rule unit is present: generate KieRuntimeBuilder implementation.
2022-12-15 20:13:21,071 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-25) CustomerLoyalty: DMN: Missing DMNShape for 'decisionLoyalty' (DMN id: _3A219F6C-99C3-44A5-84E7-781C9C6DDE35, No DMNDiagramElement is associated with the element)
2022-12-15 20:13:21,072 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-25) CustomerLoyalty: DMN: Missing DMNShape for 'loyalty' (DMN id: _1139F92D-BE31-486C-AF48-9635FB648B53, No DMNDiagramElement is associated with the element)
2022-12-15 20:13:21,074 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-25) CustomerLoyalty: DMN: Missing DMNEdge for '_B6FAD577-D619-4132-A683-D77E6EC13B42' (DMN id: _B6FAD577-D619-4132-A683-D77E6EC13B42, No DMNDiagramElement is associated with the element)
2022-12-15 20:13:21,151 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-25) Initializing DMN DT Validator...
2022-12-15 20:13:21,152 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-25) DMN DT Validator initialized.
2022-12-15 20:13:21,152 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-25) Analysing decision tables in DMN Model 'CustomerLoyalty' ...
2022-12-15 20:13:21,162 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-25)  analysis for decision table 'decisionLoyalty':
2022-12-15 20:13:21,163 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-25)   Columns: [loyalty.rank] relate to FEEL string values which can be enumerated for the inputs; Gap analysis skipped.
2022-12-15 20:13:21,279 INFO  [org.kie.kog.qua.com.dep.KogitoAssetsProcessor] (build-50) reflectiveEfestoGeneratedClassBuildItem org.kie.kogito.quarkus.common.deployment.KogitoGeneratedSourcesBuildItem@2c70ea67
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-12-15 20:13:23,350 INFO  [io.quarkus] (Quarkus Main Thread) kogito-test01 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 3.982s. Listening on: http://0.0.0.0:8085

2022-12-15 20:13:23,351 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-12-15 20:13:23,351 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, smallrye-openapi, swagger-ui, vertx]

--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>

ブラウザからKogitoへのアクセス

http://localhost:8085/にアクセス

image.png

SwaggerUIからRESTによるルール呼び出し

前の画面の「VISIT THE DEV UI」をクリック

Swagger UIをクリック
image.png

loyalty以下のrankに"ゴールド"を指定してExecute
image.png

rank"ゴールド"に対するdiscountRateとmessageが返されました。
image.png

※補足
ちなみにSwaggerUIは、デフォルトではDevelopment modeでのみ有効になっています。本番環境でも有効化したい場合は以下のようにapplication.propertiesの設定を行う必要があります。

参考: Using OpenAPI and Swagger UI - Use Swagger UI for developmentu

By default, Swagger UI is only available when Quarkus is started in dev or test mode.
If you want to make it available in production too, you can include the following configuration in your application.properties:
quarkus.swagger-ui.always-include=true
This is a build time property, it cannot be changed at runtime after your application is built.

jar作成

mvn packageにてjar作成

実行時のログ
user01@IBM-PF3ALW3Q:~/BAMOE_kogito2/kogito-test01$ mvn package
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.ibm.sample:kogito-test01 >--------------------
[INFO] Building kogito-test01 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ kogito-test01 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- quarkus-maven-plugin:2.15.0.Final:generate-code (default) @ kogito-test01 ---
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ kogito-test01 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:2.15.0.Final:generate-code-tests (default) @ kogito-test01 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ kogito-test01 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/user01/BAMOE_kogito2/kogito-test01/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ kogito-test01 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @ kogito-test01 ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.ibm.sample.GreetingResourceTest
2022-12-16 08:31:02,348 INFO  [org.kie.kog.cod.api.uti.AddonsConfigDiscovery] (build-60) Performed addonsConfig discovery, found: AddonsConfig{usePersistence=false, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false}
2022-12-16 08:31:02,430 INFO  [org.kie.kog.cod.cor.uti.ApplicationGeneratorDiscovery] (build-11) Generator discovery performed, found [processes, rules, decisions, predictions]
2022-12-16 08:31:02,431 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-11) Skipping generator 'processes' because disabled
2022-12-16 08:31:02,432 INFO  [org.kie.kog.cod.cor.ApplicationGenerator] (build-11) Skipping generator 'predictions' because disabled
2022-12-16 08:31:02,535 INFO  [org.kie.kog.cod.rul.RuleCodegen] (build-11) No rule unit is present: generate KieRuntimeBuilder implementation.
2022-12-16 08:31:03,320 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-11) CustomerLoyalty: DMN: Missing DMNShape for 'decisionLoyalty' (DMN id: _3A219F6C-99C3-44A5-84E7-781C9C6DDE35, No DMNDiagramElement is associated with the element)
2022-12-16 08:31:03,321 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-11) CustomerLoyalty: DMN: Missing DMNShape for 'loyalty' (DMN id: _1139F92D-BE31-486C-AF48-9635FB648B53, No DMNDiagramElement is associated with the element)
2022-12-16 08:31:03,321 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-11) CustomerLoyalty: DMN: Missing DMNEdge for '_B6FAD577-D619-4132-A683-D77E6EC13B42' (DMN id: _B6FAD577-D619-4132-A683-D77E6EC13B42, No DMNDiagramElement is associated with the element)
2022-12-16 08:31:03,397 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-11) Initializing DMN DT Validator...
2022-12-16 08:31:03,397 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-11) DMN DT Validator initialized.
2022-12-16 08:31:03,397 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-11) Analysing decision tables in DMN Model 'CustomerLoyalty' ...
2022-12-16 08:31:03,410 INFO  [org.kie.kog.cod.dec.DecisionValidation] (build-11)  analysis for decision table 'decisionLoyalty':
2022-12-16 08:31:03,412 WARN  [org.kie.kog.cod.dec.DecisionValidation] (build-11)   Columns: [loyalty.rank] relate to FEEL string values which can be enumerated for the inputs; Gap analysis skipped.
2022-12-16 08:31:03,584 INFO  [org.kie.kog.qua.com.dep.KogitoAssetsProcessor] (build-51) reflectiveEfestoGeneratedClassBuildItem org.kie.kogito.quarkus.common.deployment.KogitoGeneratedSourcesBuildItem@60ce4706
2022-12-16 08:31:05,969 INFO  [io.quarkus] (main) kogito-test01 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 4.664s. Listening on: http://0.0.0.0:8081
2022-12-16 08:31:05,970 INFO  [io.quarkus] (main) Profile test activated.
2022-12-16 08:31:05,970 INFO  [io.quarkus] (main) Installed features: [cdi, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, smallrye-openapi, swagger-ui, vertx]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.799 s - in com.ibm.sample.GreetingResourceTest
2022-12-16 08:31:07,434 INFO  [io.quarkus] (main) kogito-test01 stopped in 0.054s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ kogito-test01 ---
[INFO] Building jar: /home/user01/BAMOE_kogito2/kogito-test01/target/kogito-test01-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:2.15.0.Final:build (default) @ kogito-test01 ---
[INFO] Performed addonsConfig discovery, found: AddonsConfig{usePersistence=false, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false}
[INFO] Generator discovery performed, found [processes, rules, decisions, predictions]
[INFO] Skipping generator 'processes' because disabled
[INFO] Skipping generator 'predictions' because disabled
[INFO] No rule unit is present: generate KieRuntimeBuilder implementation.
[WARNING] CustomerLoyalty: DMN: Missing DMNShape for 'decisionLoyalty' (DMN id: _3A219F6C-99C3-44A5-84E7-781C9C6DDE35, No DMNDiagramElement is associated with the element)
[WARNING] CustomerLoyalty: DMN: Missing DMNShape for 'loyalty' (DMN id: _1139F92D-BE31-486C-AF48-9635FB648B53, No DMNDiagramElement is associated with the element)
[WARNING] CustomerLoyalty: DMN: Missing DMNEdge for '_B6FAD577-D619-4132-A683-D77E6EC13B42' (DMN id: _B6FAD577-D619-4132-A683-D77E6EC13B42, No DMNDiagramElement is associated with the element)
[INFO] Initializing DMN DT Validator...
[INFO] DMN DT Validator initialized.
[INFO] Analysing decision tables in DMN Model 'CustomerLoyalty' ...
[INFO]  analysis for decision table 'decisionLoyalty':
[WARNING]   Columns: [loyalty.rank] relate to FEEL string values which can be enumerated for the inputs; Gap analysis skipped.
[INFO] [org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor] reflectiveEfestoGeneratedClassBuildItem org.kie.kogito.quarkus.common.deployment.KogitoGeneratedSourcesBuildItem@6181b5c6
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 3926ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.291 s
[INFO] Finished at: 2022-12-16T08:31:11+09:00
[INFO] ------------------------------------------------------------------------

kogito起動(Javaアプリケーション)

JavaアプリケーションとしてKogitoを起動します。

user01@IBM-PF3ALW3Q:~/BAMOE_kogito2/kogito-test01$ java -jar target/quarkus-app/quarkus-run.jar
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-12-16 08:33:16,807 INFO  [io.qua.sma.ope.run.OpenApiRecorder] (main) CORS filtering is disabled and cross-origin resource sharing is allowed without restriction, which is not recommended in production. Please configure the CORS filter through 'quarkus.http.cors.*' properties. For more information, see Quarkus HTTP CORS documentation
2022-12-16 08:33:17,280 INFO  [io.quarkus] (main) kogito-test01 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.15.0.Final) started in 1.070s. Listening on: http://0.0.0.0:8085
2022-12-16 08:33:17,281 INFO  [io.quarkus] (main) Profile prod activated.
2022-12-16 08:33:17,282 INFO  [io.quarkus] (main) Installed features: [cdi, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, smallrye-openapi, vertx]

curlによるルール呼び出し

以下のcurlコマンド実行

curl_loyalty.sh
curl -X 'POST' --silent \
  'http://localhost:8085/CustomerLoyalty' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "loyalty": {
    "rank": "ゴールド"
  }
}' | jq .

以下の結果が返されました。

実行結果
{
  "loyalty": {
    "rank": "ゴールド"
  },
  "decisionLoyalty": {
    "discountRate": 0.2,
    "message": "gold member"
  }
}

KIEサーバー上のルールをRESTで呼び出す場合と比べて非常にスマートですね!
JSONデータ内にサービス実装依存(ルールエンジン依存)の情報が含まれておらず、必要な業務データのみで構成されています。
今回REST APIとして公開しているインターフェースは特に明示的な定義はしていませんが、Decisionの定義から自動で作成してくれるようです。ここでは自動で作成されるインターフェースをそのまま使って動かしてみましたが、公開するエンドポイントを明示的に定義することもできるようです。
参考: Kogitoでルールエンジン開発が更に手軽になった - サンプルにクエリを追加してみよう

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?