Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Drools 入門
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Toshiya Kobayashi
December 11, 2019
Technology
0
2.7k
Drools 入門
2019 日本 JBoss ユーザ・グループ勉強会のスライドです
https://ossbyredhat.connpass.com/event/153523/
#jjbug #drools
Toshiya Kobayashi
December 11, 2019
Tweet
Share
More Decks by Toshiya Kobayashi
See All by Toshiya Kobayashi
Event-driven business automation powered by cloud native Java
tkobayas
1
900
Other Decks in Technology
See All in Technology
EMからICへ、二周目人材としてAI全振りのプロダクト開発で見つけた武器
yug1224
3
190
EMからVPoEを経てCTOへ:マネジメントキャリアパスにおける葛藤と成長
kakehashi
PRO
6
650
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
640
チームメンバー迷わないIaC設計
hayama17
5
3.7k
LINE Messengerの次世代ストレージ選定
lycorptech_jp
PRO
19
7.2k
問い合わせ自動化の技術的挑戦
recruitengineers
PRO
2
130
Claude Cowork Plugins を読む - Skills駆動型業務エージェント設計の実像と構造
knishioka
0
240
OSSで構築するIT基盤管理実践事例: NetBox・Snipe-IT・FreeRADIUS+PrivacyIDEA / Practical Case Studies of IT Infrastructure Management Using OSS
nttcom
0
190
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4k
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
7
2k
「使いにくい」も「運用疲れ」も卒業する UIデザイナーとエンジニアが創る持続可能な内製開発
nrinetcom
PRO
1
770
技術的負債の泥沼から組織を救う3つの転換点
nwiizo
5
980
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Ethics towards AI in product and experience design
skipperchong
2
210
Deep Space Network (abreviated)
tonyrice
0
85
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
Paper Plane
katiecoart
PRO
0
47k
4 Signs Your Business is Dying
shpigford
187
22k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
590
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
260
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
150
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Transcript
DROOLS 入門 DROOLS 入門 Toshiya Kobayashi
DROOLS って何? DROOLS って何? オープンソース、Java で書かれたルールエンジン 宣言的にルールを記述する Excel スプレッドシートなど複数のフォーマットで記 述可能
クラウドネイティブにも対応(Kogito) Red Hat Decision Manager のアップストリーム
どういうときに使う? どういうときに使う? Input(POJO) をルールで処理し、Output を出力する 普通の Java でロジックを記述するのとどう違う? 宣言的(Declarative)にルールを記述する ->
実行、最適化はエンジンに任せる -> ルールのみ書けばよいのでメンテナンス性が向上 -> プログラマとビジネスアナリストの分業が容易 ルールの量が多い場合は Drools がはまる
やってみよう やってみよう rule "高額商品" when $p : Person( age >=
12 ) $o : Order( consumer == $p, itemPrice > 100000 ) then System.out.println( $p.getName() + "さん、 " + $o + " の注文をご確認 end rule "高額商品 子ども" when $p : Person( age < 12 ) $o : Order( consumer == $p, itemPrice > 5000 ) then System.out.println( $p.getName() + "さん、、 " + $o + " の注文を保護 end
DRL DRL when に条件、then にアクション(Java)を書く ルールは並列に並べるだけ ksession.insert() で ファクト(POJO) をインプット
ksession. reAllRules() でルール実行
RETE MODEL : ルールの内部表現 RETE MODEL : ルールの内部表現
デシジョンテーブル デシジョンテーブル
デシジョンテーブル デシジョンテーブル 上段にルールのテンプレートを書き、セルで値を埋めて いく プログラマとビジネスアナリストの分業が容易 スプレッドシートの1行が1ルール(DRL)に変換される
推論 推論 rule "春のキャンペーン" when $o : Order(consumer.memberCreatedAt >= "2019-04-01"
&& consumer. then System.out.println("実行 : " + kcontext.getRule().getName()); $o.setExtraPoint($o.getExtraPoint() + 2000); update($o); end rule "高額商品キャンペーン" when $o : Order(itemPrice > 100000) then System.out.println("実行 : " + kcontext.getRule().getName()); $o.setExtraPoint($o.getExtraPoint() + 4000); update($o); end
推論 推論 ルールの then でファクトを insert や update 出来る 変更をもとにルールが再評価される
変更されたプロパティが影響するルールのみ やりすぎ注意
KJAR KJAR ルールやPOJOをまとめて jar にする kie-maven-plugin Maven リポジトリから取得してルール実行
ワークベンチ(DECISION-CENTRAL) ワークベンチ(DECISION-CENTRAL) GUI でルール、ファクト、テストシナリオなどを作成 リソースは git で管理 kie-server (後述) 管理
KIE-SERVER KIE-SERVER ルール実行サーバー REST で insert, reAllRules Web アプリケーションとルールエンジンを分離
KOGITO KOGITO Drools、jBPM をクラウドネイティブに 起動が速い、メモリ消費が少ない kogito.kie.org
ほかにもいろいろ ほかにもいろいろ DMN (Decision Model and Notation) ルール記述、図表現の標準 PMML (Predictive
Model Markup Language) Machine Learning によって訓練されたモデルを実行 CEP (Complex Event Processing) リアルタイムに投入されるイベントを処理
リソース リソース drools.org Drools ブログ Red Hat Decision Manager
END END