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

Devoxx Poland 2019

74a9577769c489b07066e881764f4911?s=128

Bartłomiej Słota

June 26, 2019
Tweet

Transcript

  1. MANAGING BUSINESS PROCESSES IN MICROSERVICE ARCHITECTURE WITH SPRING ECOSYSTEM BARTŁOMIEJ

    SŁOTA @bartekslota
  2. $8bn* in 2018 * Global Business Process Management Market report

    by Value Market Research, 2019
  3. $18,5bn* by 2025 * Global Business Process Management Market report

    by Value Market Research, 2019
  4. How to reconcile BPMS with microservices?

  5. BARTŁOMIEJ SŁOTA Consultant @ Software Engineer Speaker Blogger @bartekslota bartslota.blogspot.com

    bartlomiej.slota@gmail.com github.com/bslota linkedin.com/in/bslota
  6. None
  7. BRUCE ➤ Software engineer ➤ 7 years of experience ➤

    Works on automating business processes ➤ Passionate about microservices ➤ Struggles to apply microservices into BPMS
  8. WHAT ARE MICROSERVICES? Autonomy Resilience Data Deployment Technology Scalability People

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

    C. Martin Clean Architecture
  10. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People Source: Robert

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

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

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

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

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

    QA PO
  16. Ignorance is coded, committed and pushed to Git

  17. None
  18. THE BUSINESS FLOW Source: Alberto Brandolini EventStorming

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

    SOLVE HARD TO DISCUSS HARD TO VISUALIZE
  20. THE BUSINESS FLOW VS MICROSERVICES App #2 App #3 App

    #4 App #1 Based on: Alberto Brandolini EventStorming
  21. BPM - THE BUSINESS PERSPECTIVE Process Modeler Common UI System

    integration Reporting Workflow Engine
  22. BPM - ARCHITECTURE PERSPECTIVE

  23. BPM - ARCHITECTURE PERSPECTIVE

  24. BPM - ARCHITECTURE PERSPECTIVE

  25. BPM - ARCHITECTURE PERSPECTIVE

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

    People
  27. BPM - HOW DEVELOPER MIGHT PERCEIVE IT?

  28. SAMPLE PROCESS - EVENT STORMING

  29. SAMPLE PROCESS

  30. SAMPLE PROCESS Customer Contact AML Authorizer Based on: Alberto Brandolini

    EventStorming
  31. ASYNCHRONOUS CHOREOGRAPHY

  32. ASYNCHRONOUS ORCHESTRATION

  33. SAGAS

  34. ARCHITECTURE

  35. ARCHITECTURE

  36. ARCHITECTURE

  37. 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 { }
  38. PROCESS ORCHESTRATION 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(); }
  39. 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 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(); }
  40. 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()); } }
  41. 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”)); }
  42. HOW DO I GET MY FANCY REPORTS?

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

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

    BE FE QA PO ?
  45. ENTERPRISE INTEGRATION PATTERNS YOU WILL USE (SUB)CONSCIOUSLY ➤ Command message

    ➤ Event message ➤ Process manager ➤ Transactional client ➤ Event driven consumer ➤ Idempotent receiver ➤ …
  46. BPM - THE BUSINESS PERSPECTIVE REVISITED Process Modeler Common UI

    System integration Reporting N x Process Orchestrators
  47. BPM - ARCHITECTURE PERSPECTIVE REVISITED Autonomy Resilience Data Deployment Technology

    Scalability People
  48. BPM - DEVELOPER PERSPECTIVE REVISITED

  49. DDD BY EXAMPLES - LIBRARY

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