Contenu connexe
Similaire à Scala in our BRMS (20)
Scala in our BRMS
- 1. Scala in our BRMS
~BRMS開発でのScala利用事例~
BRMS: Business Rule Management System
三菱UFJインフォメーションテクノロジー株式会社
ITプロデュース部
土佐鉄平
Mitsubishi UFJ Information Technology, Ltd.
IT Production Dept.
Teppei Tosa
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 1
- 2. Agenda
1. About MUFG, MUIT
2. About BRMS
3. About our original BRMS, “BIWARD”
4. How we have used Scala’s features in
BIWARD
Using the Recursive Call function
Using DSL
5. Our thoughts on Scala in developing
Enterprise Applications
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 2
- 3. About MUFG 出典:MUFG Corporate Review
http://www.mufg.jp/english/ir/annualreport/2012mufg/pdf/mar/cr1202.pdf
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 3
- 4. About MUIT
(Mitsubishi UFJ Information Technology, Ltd.)
Started on July 1st, 2009 when these three companies merged
Tokyo Mitsubishi Information Technology, Ltd.
UFJ Hitachi Systems, Ltd.
UFJIS, Ltd.
For Bank Systems
Amount of Capital: 181 million yen
Capital from Bank of
For Securities’ system For Credit Cards
Tokyo Mitsubishi UFJ: 85%
Capital from MUFG: 15%
Currently over 1500 employees
For Lease Systems For MUFG’s Members
For outside financial institutions
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 4
- 5. About BRMS
(Business Rule Management System)
アプリケーションから、ビジネスルール(業務判断ロジック)を切出して実行・設計・
管理を行うためのフレームワーク
BRMS is a framework that separates business logic from software
applications and executes, designs and manages that logic.
WEB/AP Server Executes
Executes
Business Application
Rule Engine DB
Framework (ex. JavaEE)
Server
Client
WEB/AP Server (ex. Cosminexus、Websphere、GlassFish)
OS (ex. RedhatLinux、AIX)
Designs
Designs Rule Base Manages
Manages
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 5
- 7. The Reason for Creating an Original BRMS
金融関連のBRMS事例は保険のバックオフィス業務への適用が多いが、銀行では対面型業務での適用ニーズがあり、市場
製品では「前進判断」機能のみのため、これに応えることができない。
In the financial industry, there are some back-offices at insurance companies that use BRMSs. However, all banks
have to use BRMS for their teller-window type operations. Other BRMS products cannot fulfill our needs because
they have only “forward execution” functions.
Back-office Type
Input operations are fixed.
Papers
The system calculates how
Rule Engine payments need to be made
based on accident and
contract information.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 7
- 8. The Reason for Creating an Original BRMS
金融関連のBRMS事例は保険のバックオフィス業務への適用が多いが、銀行では対面型業務での適用ニーズがあり、市場
製品では「前進判断」機能のみのため、これに応えることができない。
In the financial industry, there are some back-offices at insurance companies that use BRMSs. However, all banks
have to use BRMS for their teller-window type operations. Other BRMS products cannot fulfill our needs because
they have only “forward execution” functions.
Back-office Type Teller-window Type
Input operations are fixed. At teller-windows, we interact directly with
customers, so we require a BRMS with not only
“forward execution” but also “backward execution”.
Papers
Sorry, we can’t authenticate
you with this kind of ID.
【forward execution】
】
So, what should I do?
If you have a driver’s license or a
health insurance ID card…
The system calculates how
Rule Engine payments need to be made 【backward execution】
】
based on accident and
I have a health
contract information.
insurance ID card.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 8
- 9. Algorithm for BIWARD
Logic operating in a TREE form
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 9
- 10. Algorithm for BIWARD
Logic operating in a TREE form
Forward Execution
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 10
- 11. Algorithm for BIWARD
Logic operating in a TREE form Logic operating as a NETWORK
Forward Execution
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 11
- 12. Algorithm for BIWARD
Logic operating in a TREE form Logic operating as a NETWORK
Forward Execution Forward Exec.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 12
- 13. Algorithm for BIWARD
Logic operating in a TREE form Logic operating as a NETWORK
Forward Execution Forward Exec. Backward Exec.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 13
- 14. Algorithm for BIWARD
Logic operating in a TREE form Logic operating as a NETWORK
Forward Execution Forward Exec. Backward Exec. Biward Exec.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 14
- 15. Example: Logic for Authentication
Conditions Result
Bring a Have a Bring a
Can authenticate
driver’s license home loan resident card
YES YES
YES
YES NO NO
NO YES
NO NO
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 15
- 16. Internal Structure of Logic
Root :Node
Conditions Result
Bring a Have a Bring a
Can authenticate
driver’s license home loan resident card
Y
Y
Y Y
N
N
N
N
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 16
- 17. BIWARD walks on nodes recursively.
BIWARDはRootNodeからスタートして、RootNodeまでを辿る
辿ったNodeを記録しながら、「walk」関数を再帰的に処理していき、
最終的に記録したNodeを結果として応答
Scalaによって、こういった処理を非常にシンプルに構築
BIWARD can “walk” on the network in both directions from the
Root Node and back to the Root Node.
The nodes use the “walk” function to call one another recursively.
BIWARD records the nodes that have been “walked” through,
then returns the results by displaying the recorded nodes.
Thanks to Scala, we were able to create this program very
elegantly.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 17
- 18. Steps of Creating Rules
Compiles
Compiles
XML register
register Scala and
and
packages
packages
JAR
Exported from WEB-UI
or input by the user
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 18
- 19. Using Scala’s Parser
BIWARD parses these conditional expressions with Scala’s DSL function.
<rule id=“rule1” … >
<parameters>
運転免許証持参有無”
運転免許証持参有無
<booleanParameter id=“hasDriversLicence” label=“運転免許証持参有無 … />
…
</parameters>
<results> Not only boolean, but
<booleanResult id=“canAuthenticate” label=“本人確認可否本人確認可否”/>
本人確認可否 also strings, numbers
</results> and date types in
<patterns> conditional expressions.
<pattern>
<conditions>
<condition … ><![CDATA[ param(“hasDriversLicense”)==true ]]></condition>
</conditions>
<results>
<booleanResult id=“canAuthenticate”>true</booleanResult>
</results>
</pattern>
… Exported Scala Code
Condition(Equal(
</patterns>
BooleanParameter(“”“9”“”, “”“bringDriversLicense”“”,
</rule> List(BooleanValue(true, """Yes"""), BooleanValue(false, """No"""))),
BooleanValue(true, """Yes""")
)),
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 19
- 20. Thoughts on Scala
高生産性を確かに実感
Javaとの親和性メリットは大きい
ScalaプログラムがJavaリソースを利用するという観点はもちろん、
Javaに対してScalaリソースを提供するという観点でもメリット大きい。
言語仕様が強力で、標準言語とするにはまだまだハードル高い
Javaの置き換えではなく、ポイントを抑えた部分的な活用が有効
Achieve a higher level of productivity
Compatibility with Java is a strong merit
Scala can use Java as a library, and Java can use Scala the same way.
As a result of its elaborate syntax, it will still be difficult to adopt
Scala as the standard.
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 20
- 21. Our Goal for Scala
DSLやJavaAPIを通した機能提供を前提に、より汎
用的な機能の開発にScalaを活用
To develop universal features with Scala and
supply them using DSL or Java API
DSL
Business Application Common Parts (Scala)
(Java) Java API
Common Parts (Java)
Specific features for business Universal features
All Rights Reserved,Copyright © 2013 Mitsubishi UFJ Information Tecnology,Ltd. 21