Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Managing Business Processes in Microservice Architecture with Spring Ecosystem

Managing Business Processes in Microservice Architecture with Spring Ecosystem

74a9577769c489b07066e881764f4911?s=128

Bartłomiej Słota

March 28, 2019
Tweet

Transcript

  1. MANAGING BUSINESS PROCESSES IN MICROSERVICE ARCHITECTURE WITH SPRING ECOSYSTEM Bartłomiej

    Słota
  2. BARTŁOMIEJ SŁOTA Consultant @ Speaker Blogger @bartekslota bartslota.blogspot.com bartlomiej.slota@gmail.com github.com/bslota

    linkedin.com/in/bslota
  3. GOALS ➤ Know the motivation for BPM solutions ➤ How

    to bring BPM and microservices together ➤ How EventStorming can help us understand business processes ➤ Give insight into BPM from perspectives of: ➤ Business ➤ Architecture ➤ Development ➤ Tools
  4. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People

  5. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People Source: Robert

    C. Martin Clean Architecture
  6. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People App #1

    Source: www.trunkbaseddevelopment.com App #2 Source: www.leanpub.com/git-flow/read
  7. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People App #1

    App #2 App #3
  8. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People

  9. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People App #2

    App #1
  10. Resilience MICROSERVICES Autonomy Data Deployment Technology Scalability People BE FE

    QA PO
  11. MICROSERVICES ARE PEOPLE

  12. None
  13. THE BUSINESS FLOW Source: Alberto Brandolini EventStorming

  14. THE BUSINESS FLOW Based on: Alberto Brandolini EventStorming HARD TO

    SOLVE HARD TO DISCUSS HARD TO VISUALIZE
  15. THE BUSINESS FLOW VS MICROSERVICES Source: Alberto Brandolini EventStorming App

    #2 App #3 App #4 App #1
  16. BPM - THE BUSINESS PERSPECTIVE Process Modeler Common UI System

    integration Reporting Workflow Engine
  17. BPM - ARCHITECTURE PERSPECTIVE

  18. BPM - ARCHITECTURE PERSPECTIVE Autonomy Resilience Data Deployment Technology Scalability

    People
  19. BPM - DEVELOPER PERSPECTIVE

  20. BPM - TOOLS PERSPECTIVE

  21. IS IT THAT BAD? ➤ Business first ➤ Strategy ➤

    Cost ➤ Time limits ➤ Resources available ➤ Skillset ➤ … Never bite more than you can chew!
  22. BUT WE WANT MICROSERVICES Source: Martin Fowler https://martinfowler.com/bliki/MicroservicePrerequisites.html RAPID PROVISIONING

    BASIC MONITORING RAPID APPLICATION DEPLOYMENT DEVOPS CULTURE
  23. BUT WE WANT MICROSERVICES Source: Martin Fowler https://martinfowler.com/bliki/MicroservicePrerequisites.html What if

    we are here?
  24. MONOLITH FIRST Source: Martin Fowler https://martinfowler.com/bliki/MonolithFirst.html

  25. WE ALL CAN DO IT! Source: Martin Fowler https://martinfowler.com/bliki/MicroservicePrerequisites.html

  26. SAMPLE PROCESS - EVENT STORMING

  27. SAMPLE PROCESS

  28. ASYNCHRONOUS CHOREOGRAPHY

  29. ASYNCHRONOUS ORCHESTRATION

  30. SAGAS

  31. ARCHITECTURE

  32. ARCHITECTURE

  33. ARCHITECTURE

  34. CONVENTION OVER CONFIGURATION @JsonSubTypes({ @JsonSubTypes.Type(name = „processInstanceCreated", value = ProcessInstanceCreated.class),

    @JsonSubTypes.Type(name = "processInstanceCancelled", value = ProcessInstanceCancelled.class), @JsonSubTypes.Type(name = "processInstanceCompleted", value = ProcessInstanceCompleted.class), @JsonSubTypes.Type(name = "taskCreated", value = TaskCreated.class), @JsonSubTypes.Type(name = "taskProcessingFailed", value = TaskProcessingFailed.class), @JsonSubTypes.Type(name = "taskCompleted", value = TaskCompleted.class), @JsonSubTypes.Type(name = "taskAssigned", value = TaskAssigned.class) }) public interface BPMEvent { }
  35. PROCESS ORCHESTRATION public interface AccessVerificationChannels { String ACCESS_EVENTS = "accessEvents";

    String ACCESS_COMMANDS = "accessCommands"; @Input(ACCESS_EVENTS) SubscribableChannel accessEvents(); @Output(ACCESS_COMMANDS) MessageChannel accessCommands(); } public interface AddressChangeProcessChannels { String ADDRESS_CHANGE_PROCESS_COMMANDS = "addressChangeProcessCommands"; String ADDRESS_CHANGE_PROCESS_EVENTS = "processEvents"; @Input(ADDRESS_CHANGE_PROCESS_COMMANDS) SubscribableChannel addressChangeProcessCommands(); @Output(ADDRESS_CHANGE_PROCESS_EVENTS) MessageChannel addressChangeProcessEvents(); } public interface AddressChannels { String ADDRESS_EVENTS = "addressEvents"; String ADDRESS_COMMANDS = "addressCommands"; @Input(ADDRESS_EVENTS) SubscribableChannel addressEvents(); @Output(ADDRESS_COMMANDS) MessageChannel addressCommands(); } public interface AMLChannels { String ADDRESS_EVENTS = "amlEvents"; String ADDRESS_COMMANDS = "amlCommands"; @Input(ADDRESS_EVENTS) SubscribableChannel amlEvents(); @Output(ADDRESS_COMMANDS) MessageChannel amlCommands(); }
  36. HOW DO I KNOW THAT THE SERVICE ANSWERS TO MY

    PROCESS? ➤ Add the header to every message in process manager ➤ Copy the header back with the response ignoring the content @JsonCreator public ProcessMetadata(@JsonProperty("processInstanceId") String processInstanceId, @JsonProperty("parentId") String parentId, @JsonProperty("processDefinitionId") String processDefinitionId) { this.processInstanceId = processInstanceId; this.parentId = parentId; this.processDefinitionId = processDefinitionId; } class AccessVerification { private final MessageChannel accessCommands; . . . private void sendVerifyAccessCommand(ProcessMetadata metadata, String clientId, String masterPassword) { final VerifyAccess verifyAccess = new VerifyAccess(clientId, masterPassword); accessCommands.send(MessageBuilder.withPayload(verifyAccess).copyHeaders(metadata.toMap()).build()); } }
  37. HOW DO I GET TASKS ASSIGNED TO A USER? KTable<User,

    Tasks> userTasks() { return streamsBuilder .stream(„processEvents”, Consumed.with(serdes.forA(String.class), serdes.forA(Task.class))) .groupBy((key, task) -> task.getUser(), Serialized.with(serdes.forA(User.class), serdes.forA(Task.class))) .aggregate(Tasks::empty, (TaskAggregator<User, Task, Tasks>) (user, task, tasks) -> tasks.add(task), materializedAs(„userTasks”)); }
  38. HOW DO I GET MY FANCY REPORTS?

  39. HOW DO I MONITOR MY PROCESSES? ➤ Spring Cloud Sleuth

    ➤ Zipkin ➤ ELK ➤ Prometheus ➤ Semantic monitoring
  40. PROCESS VS SERVICE OWNERSHIP PROCESS #3 PROCESS #2 PROCESS #1

    BE FE QA PO ?
  41. COMMON UI Source: Tom Söderlund https://bit.ly/2vJH8NJ

  42. ENTERPRISE INTEGRATION PATTERNS YOU WILL USE (SUB)CONSCIOUSLY ➤ Command message

    ➤ Event message ➤ Message identifier ➤ Routing slip ➤ Process manager ➤ Transactional client ➤ Polling consumer ➤ Event driven consumer ➤ Idempotent receiver ➤ Message History ➤ Message Store ➤ Message Dispatcher
  43. BPM - THE BUSINESS PERSPECTIVE REVISITED Process Modeler Common UI

    System integration Reporting Workflow Engine
  44. BPM - DEVELOPER PERSPECTIVE REVISITED

  45. BPM - TOOLS PERSPECTIVE REVISITED

  46. BPM - ARCHITECTURE PERSPECTIVE REVISITED Autonomy Resilience Data Deployment Technology

    Scalability People
  47. THANK YOU! @bartekslota bartslota.blogspot.com bartlomiej.slota@gmail.com github.com/bslota linkedin.com/in/bslota