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

Bartłomiej Słota

March 28, 2019
Tweet

More Decks by Bartłomiej Słota

Other Decks in Programming

Transcript

  1. 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
  2. MICROSERVICES Autonomy Resilience Data Deployment Technology Scalability People App #1

    Source: www.trunkbaseddevelopment.com App #2 Source: www.leanpub.com/git-flow/read
  3. IS IT THAT BAD? ➤ Business first ➤ Strategy ➤

    Cost ➤ Time limits ➤ Resources available ➤ Skillset ➤ … Never bite more than you can chew!
  4. 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 { }
  5. 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(); }
  6. 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()); } }
  7. 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”)); }
  8. HOW DO I MONITOR MY PROCESSES? ➤ Spring Cloud Sleuth

    ➤ Zipkin ➤ ELK ➤ Prometheus ➤ Semantic monitoring
  9. 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
  10. BPM - THE BUSINESS PERSPECTIVE REVISITED Process Modeler Common UI

    System integration Reporting Workflow Engine