jBPM • Event-Driven Business Automation with Kogito • Cloud-native business automation on Openshift + • Quarkus: an open source stack to write cloud native Java apps
tasks that, once completed following a specific workflow, will accomplish an organizational goal • Rules Encapsulate domain and define business-specific constraints and behaviors, keeping them separated from the main application flow
more naturally translated into rules. It is more likely for a technically skilled business analyst to verify, validate or even change a rule than a piece of Java code • Improved maintainability → We don't care about how to implement a solution only what needs to be done to solve a problem • Deals with evolving complexity → It's easier to modify a rule than a Java program and to determine the impact of this change on the rest of the application • Modularity → Each rule models an isolated and small portion of your business logic and is not part of a monolithic program • Clear separation of business logic from the rest of the system → Business and infrastructural code have very different life cycles • Complex Event Processing → Facts can be handled like timestamped events allowing temporal reasoning on them RULES
a computation efficient representation of the set of the defined rules • The Working Memory contains the set of facts inserted into session • The engine matches the fact in the working memory against the rules set • When a match is found it creates an activation and puts it into the agenda • An activation is the tuple of facts matching the conditions of a rule plus the rule itself • When all activations have been created the agenda elects through a conflict resolution strategy the one to be executed first • The elected activation is passed to the execution engine and then fired
insert( new Alarm( "house1" ) ); System.out.println( "Raise the Alarm"); end rule CancelAlarm when not Fire() a : Alarm() then delete( a ); System.out.println( "Cancel the Alarm"); end rule TurnSprinklerOn when s : Sprinkler( on == false ) f : Fire( room == s.room ) then modify( s ) { setOn( true ) } System.out.println( "Turn on the sprinkler for room " + f.getRoom().getName() ); end rule TurnSprinklerOff when s : Sprinkler( on == true ) not Fire( room == s.room ) then modify( s ) { setOn( false ) } System.out.println( "Turn off the sprinkler for room " + s.getRoom().getName() ); end rule OK when not Alarm() not Sprinkler( on == true ) then System.out.println( "Everything is ok" ); end Pattern-matching against objects in the Working Memory Code executed when a match is fired
into reusable assets such as cases, processes, decision tables and more. It consists of: • business processes (BPMN2) • case management (BPMN2 and CMMN) • decision management (DMN) • business rules (DRL) A toolkit for building business applications to help automate business processes and decisions
cloud as this is where your business logic lives these days • Achieves amazingly fast boot time and low memory footprint by leveraging latest technology ◦ Quarkus ◦ Kubernetes ◦ OpenShift ◦ KNative The reasons for a change
automation: ◦ Rules and Decisions ◦ Processes and Cases • ... under the covers ◦ the backbone is code generation based on business assets ◦ executable model for the process/rule/decision definitions ◦ type safe data model that encapsulates variables ◦ REST api for each public business process/decision/rule Introducing Kogito
way around • No more leaking of abstractions of the platform into your client applications • Stay focused on business requirements instead of implementation technology Focus on business domain instead of technology
wherever you need it ◦ Code generation taking care of 80% of the work ◦ Flexibility to customize, only use what you need ◦ Simplified local development with live reload Offers a powerful developer experience
cloud as this is where your business logic lives these days • Achieves amazingly fast boot time and low memory footprint by leveraging newest technology ◦ Quarkus ◦ Kubernetes/OpenShift/KNative Designed from ground up to run at scale
dev mode and provide hot-reload capabilities • Changes made to source and configuration files are automatically re-compiled once the browser is refreshed • Thanks to Kogito’s Quarkus extension, also Drools and jBPM files are recognized as hot reloadable artifacts and the corresponding rules and processes are regenerated
service ◦ deals with Travel requests submitted by travellers ◦ assesses if there is a need for visa ◦ books hotel and flights ◦ awaits confirmation from traveller • Single service that ◦ exposes REST api ◦ provides simple UI
curl -L http://bit.ly/get-kogito-ext | sh • You can also install manually - download vsix from https://github.com/kiegroup/kogito-tooling/releases/tag/0.2.0 - install from vsix in VSCode
move as much as possible at build-time of what formerly was done at compile-time • Ahead-of-time optimizations ◦ Dead code elimination ◦ Code generation instead of reflection + dynamic class loading • Starts key parts of application ahead-of-time
for rules and processes authoring • A pure Java canonical representation of a rule base • Automatically generated by Maven plugin or Quarkus extension ◦ Can be embedded in jar ◦ Faster boot • Improve Backward/Forward compatibility • Allow for faster prototyping and experimentation of new features
◦ unnecessary dynamic class loading ◦ process as much info at compile time • Benefits ◦ faster startup-time ◦ enable ahead-of-time native compilation Shameless Plug: Your Program as a Transpiler: Applying Compiler Design to Everyday Programming Wednesday @ 12:00 -- Room 9 (Edoardo)
specific (aka native) executable from your Java code • Trade-offs: lack of build-once-run-anywhere and hot reload capabilities VS. lower on-disk footprint and quicker startup time • Perfect fit for serverless/event-driven environments where we need to spin up a service in real time to react to an event • Statically compiled executables benefit from closed-world optimizations, such as fine-grained dead-code elimination, where only the portions of frameworks (including the JDK itself) actually in use by the service are included in the resulting image
Spring Boot • Provision services on demand and remove them when no longer needed • Manage deployed services including their dependencies • Service discovery based on labels • Guarding services of losing their dependants • Security provisioning and propagation Operator
CLI tool ◦ kogito new-app travel-agency Create new OpenShift project with default services provisioned ◦ kogito deploy travel-agency https://github.com/.../travelapp Deploys given application from source and attaches to required infrastructure ◦ kogito deploy visas https://github.com/.../visasapp Deploys given application from source and attaches to required infrastructure Designed from ground up to run at scale
byte[] • Infinispan used as default persistent store • Stores ◦ Process Instance and Node Instance information ◦ Process Instance variables ▪ Marshalling of both process/node instance and variables is done by protobuf • Each process definition is stored in its own cache to improve management and concurrency
◦ processes ◦ user tasks ◦ decision and rules • Indexes it in domain specific way • Exposes GraphQL based API • Provides unified view on technical aspects of the running services
• Java Bytecode and JVM languages • Interop with different languages • Dynamic languages through Truffle API Cross-language interop out of the box • Simple AST-based interpreter • JIT across language boundaries Support for native binary compilation (SubstrateVM) • faster boot-up • lower memory footprint
name, byte[] bytecode ) { throw new UnsupportedOperationException(); } } Drools on GraalVM – other refactors Dynamic class definition is no longer necessary