Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Kogito: cloud native business automation

Kogito: business automation in the cloud

  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

Kogito: cloud native business automation

  1. 1. Kogito: Cloud-native Business Automation Mario Fusco, Edoardo Vacchi
  2. 2. Mario Fusco Red Hat Principal Sw Engineer Drools project lead Kogito founder Java Champion Edoardo Vacchi Red Hat Senior Sw Engineer Kogito founder
  3. 3. Agenda ● Business automation in the cloud: a serverless workflow - demo ● What is business automation: introduction to Drools and jBPM ● Kogito: business automation in the cloud ● Quarkus: an open source stack to write cloud native Java apps ● Decisions as a service: serverless DMN - demo +
  4. 4. ● World around us has changed ● Different usage patterns ● New deployment techniques ● Better usage of machine and cluster resources The reasons for a change
  5. 5. Application Density CONTAINER ORCHESTRATION Server Server Server Traditional Java Stack NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS Traditional Java Stack Traditional Java Stack Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go
  6. 6. Application Density CONTAINER ORCHESTRATION Server Server Server NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Native Java Native Java Native Java Native Java Native Java Native Java Native Java Native Java Native Java Native Java Native Java Native Java
  7. 7. “I am your density”
  8. 8. Traditional vs. Modern Kubernetes OpenShift Jaeger Apache Kafka
  9. 9. Cloud-Native Development
  10. 10. Serverless
  11. 11. “building and running applications that do not require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment.” event action result$ CNCF Serverless Whitepaper v1.0
  12. 12. Function Orchestration f g
  13. 13. Workflows ● Workflow is the procedural movement of information, material, and tasks from one participant to another ● A workflow may be sequential, with each step contingent upon completion of the previous one, or parallel, with multiple steps occurring simultaneously
  14. 14. Serverless Workflows
  15. 15. serverlessworkflow.io
  16. 16. id: ... version: '1.0' name: ... description: ... functions: - ... events: - ... states: - ...
  17. 17. Hello World id: helloworld version: '1.0' name: Hello World Workflow description: Inject Hello World states: - name: Hello State type: inject start: kind: default data: result: Hello World! end: kind: default
  18. 18. id: greeting version: '1.0' name: Greeting Workflow description: Greet Someone functions: - name: greetingFunction resource: functionResourse states: - name: Greet type: operation start: kind: default actions: - functionRef: refName: greetingFunction parameters: name: "{{ $.person.name }}" actionDataFilter: dataResultsPath: "{{ $.greeting }}" end: kind: default Hello World (2)
  19. 19. Knative
  20. 20. Serving An event-driven model that serves the container with your application and can "scale to zero".
  21. 21. Eventing Common infrastructure for consuming and producing events that will stimulate applications.
  22. 22. Kogito Business Automation in the Cloud
  23. 23. Cogito, ergo sum Pronunciation /ˈko.d͡ ʒi.to/, [ˈkoː.d͡ ʒi.to] (Don't worry, nobody in the team gets it right, anyway) see also: http://kverlaen.blogspot.com/2019/09/etymology-of-kogito.html René Descartes
  24. 24. Kogito, ergo automate ● BTW, this is not Mario ● Not a pirate ● It is a viking ● Odin, who sacrificed his eye for knowledge
  25. 25. ● A cloud-native development, deployment and execution platform for business automation: ○ Rules and Decisions ○ Processes and Cases ○ Serverless Workflow ● ... 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
  26. 26. Kogito Operator
  27. 27. ● Responsible for building with selected runtime ○ Quarkus ○ 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
  28. 28. ● Deploy and manage your services with operator and intuitive CLI tool $ kogito new-app my-app Create new project with default services provisioned $ kogito deploy my-app https://github.com/user/myapp Deploys given application from source and attaches to required infrastructure Operator centric
  29. 29. Serverless Workflow A Complete Example
  30. 30. id: yamlgreet version: '1.0' name: Greeting workflow description: YAML based greeting workflow functions: - name: greetFunction type: sysout states: - name: ChooseOnLanguage type: switch start: kind: default dataConditions: - path: "$.language" value: English operator: equals transition: nextState: GreetInEnglish - path: "$.language" value: Spanish operator: equals transition: nextState: GreetInSpanish default: nextState: GreetInEnglish - name: GreetInEnglish type: inject data: greeting: 'Hello from YAML Workflow, ' transition: nextState: GreetPerson - name: GreetInSpanish type: inject data: greeting: 'Saludos desde YAML Workflow, ' transition: nextState: GreetPerson - name: GreetPerson type: operation actions: - name: greetAction functionRef: refName: greetFunction parameters: message: "$.greeting $.name" end: kind: terminate
  31. 31. GreetInSpanish GreetInEnglish ChooseOnLanguage GreetPerson { "workflowdata": { "name" : "John", "language": "English" } } language == "Spanish" language == "English" (default)
  32. 32. GreetInSpanish GreetInEnglish ChooseOnLanguage GreetPerson language == "Spanish" language == "English" (default) - name: ChooseOnLanguage type: switch start: kind: default dataConditions: - path: "$.language" value: English operator: equals transition: nextState: GreetInEnglish - path: "$.language" value: Spanish operator: equals transition: nextState: GreetInSpanish default: nextState: GreetInEnglish
  33. 33. GreetInSpanish GreetInEnglish ChooseOnLanguage GreetPerson language == "Spanish" language == "English" (default) - name: GreetInEnglish type: inject data: greeting: 'Hello from YAML Workflow, ' transition: nextState: GreetPerson - name: GreetInSpanish type: inject data: greeting: 'Saludos desde YAML Workflow, ' transition: nextState: GreetPerson - name: GreetPerson type: operation actions: - name: greetAction functionRef: refName: greetFunction parameters: message: "$.greeting $.name"
  34. 34. Serverless Workflow Knative Demo
  35. 35. Business Automation
  36. 36. What is Business Automation ● Processes Set of activities and 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
  37. 37. Drools A Rule Engine
  38. 38. What is a Rule ● A business rule is a piece of logic that captures "what to do" depending on a context (Facts) ● Usually captured in natural language first WHEN <CONDITIONS> THEN <ACTIONS>
  39. 39. Introducing Drools ● Easier to understand → Requirements can be 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
  40. 40. How a Rule Engine Works ● The Rule Base contains 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
  41. 41. A simple rule set rule RaiseAlarm when exists Fire() then 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
  42. 42. jBPM A Workflow Engine
  43. 43. Almost anything in any domain can be expressed as process or rule. It’s a matter of recognizing patterns to be able to avoid repetition and mistakes, and by that automating business.
  44. 44. jBPM provides various capabilities that simplify and externalize business logic 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
  45. 45. jBPM … a business process
  46. 46. Kogito ergo domain
  47. 47. ● Adapts to your business domain instead of the other way around ● No more leaking abstractions of the platform into your client applications ● Stay focused on business requirements instead of implementation technology Focus on business domain instead of technology
  48. 48. Kogito ergo power
  49. 49. ● Achieve instant developer efficiency by having ○ Tooling embeddable 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
  50. 50. Kogito ergo cloud
  51. 51. ● If you think about business automation think about the 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
  52. 52. Quarkus Supersonic Subatomic Java
  53. 53. Introducing Quarkus ● A Framework for writing (fast and lightweight) Java applications
  54. 54. ● A Framework for writing (fast and lightweight) Java applications ● Code generation reduces startup time and memory footprint (bonus: GraalVM native image) Introducing Quarkus
  55. 55. ● A Framework for writing (fast and lightweight) Java applications ● Code generation reduces startup time and memory footprint (bonus: GraalVM native image) ● Exposes existing standard ○ Servlet ○ JAX-RS ○ JPA, JDBC ○ CDI ○ Bean Validation ○ Transactions ○ Logging ○ Microprofile Introducing Quarkus
  56. 56. Quarkus Extensions
  57. 57. Why Quarkus
  58. 58. Hot Reload ● ./mvn compile quarkus:dev makes Quarkus run in 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
  59. 59. Kogito Architecture
  60. 60. Architecture
  61. 61. Automatic REST endpoint generation & Scaffolding
  62. 62. rule LargeDepositApprove when $l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount <= maxAmount ] then modify($l) { setApproved(true) }; end query FindApproved $l: /loanApplications[ approved ] end
  63. 63. rule LargeDepositApprove when $l: /loanApplications[ applicant.age >= 20, deposit >= 1000, amount <= maxAmount ] then modify($l) { setApproved(true) }; end query FindApproved $l: /loanApplications[ approved ] end @Path("/find-approved") public class LoanUnitQueryFindApprovedEndpoint { @javax.inject.Inject() RuleUnit<org.kie.kogito.queries.LoanUnit> ruleUnit; @POST() @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public List<LoanApplication> executeQuery(LoanUnit unitDTO) { RuleUnitInstance<LoanUnit> instance = ruleUnit.createInstance(unitDTO); return instance.executeQuery(LoanUnitQueryFindApproved.class); } } Automatically generate REST endpoint
  64. 64. DMN Decisions as a Service
  65. 65. What is DMN? ● DMN (Decision Model and Notation) is a standard for Decision Management from OMG ● Standardizes decision automation from modelling to execution ● A sibling and complementary standard to BPMN (processes) and CMMN (case management) ● A complement to analytics and AI models in general ○ DMN integrates with analytic models and provides explainable white box decisions ● DMN models are stateless only (perfect fit for serverless architectures)
  66. 66. DMN introduction: a simple example
  67. 67. DMN introduction: a simple example Input Node Decision Node Business Knowledge Model
  68. 68. DMN & Hot Reload - Demo Decisions as a Service
  69. 69. Questions?
  70. 70. Get started http://kogito.kie.org

×