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

Click 2019, Lublin

74a9577769c489b07066e881764f4911?s=128

Bartłomiej Słota

May 11, 2019
Tweet

Transcript

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

    Słota
  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. None
  17. THE BUSINESS FLOW Source: Alberto Brandolini EventStorming

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

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

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

    integration Reporting Workflow Engine
  21. BPM - ARCHITECTURE PERSPECTIVE

  22. BPM - ARCHITECTURE PERSPECTIVE

  23. BPM - ARCHITECTURE PERSPECTIVE

  24. BPM - ARCHITECTURE PERSPECTIVE

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

    People
  26. BPM - HOW DEVELOPER MIGHT PERCEIVE IT?

  27. SAMPLE PROCESS - EVENT STORMING

  28. SAMPLE PROCESS

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

    EventStorming
  30. ASYNCHRONOUS CHOREOGRAPHY

  31. ASYNCHRONOUS ORCHESTRATION

  32. SAGAS

  33. ARCHITECTURE

  34. ARCHITECTURE

  35. ARCHITECTURE

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

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

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

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

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

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

    Scalability People
  46. BPM - DEVELOPER PERSPECTIVE REVISITED

  47. DDD BY EXAMPLES - LIBRARY

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