Summary (สรุป)

ดังนั้นอย่างที่เราเห็น ทางไปสู่การ implement workflow ใน microservice architecture ของเราขึ้นอยู่กับการ model business process ที่เรากำลังพยายาม implement อย่างชัดเจน นี่พาเรากลับไปที่แนวคิดของการ model แง่มุมของ business domain ของเราใน microservice architecture การ model business process อย่างชัดเจนสมเหตุสมผลถ้า microservice boundary ของเราถูกนิยามโดยหลักในแง่ของ business domain ของเราเช่นกัน

ไม่ว่าคุณจะตัดสินใจโน้มเอียงไปทาง orchestration หรือ choreography มากกว่า หวังว่าตอนนี้คุณอยู่ในตำแหน่งที่ดีขึ้นมากที่จะรู้ว่า model ไหนจะเหมาะกับปัญหาของคุณมากกว่า

ถ้าคุณอยากสำรวจพื้นที่นี้เพิ่มเติม แม้ saga จะไม่ได้ถูกครอบคลุมอย่าง ชัดเจน Enterprise Integration Patterns โดย Gregor Hohpe และ Bobby Woolf มี pattern มากมายที่มีประโยชน์อย่างมากเมื่อ implement workflow ประเภทต่าง ๆ 8 ผมยังแนะนำอย่างจริงใจ Practical Process Automation โดย Bernd Ruecker 9 หนังสือของ Bernd เน้นไปที่ด้าน orchestration ของ saga มากกว่า แต่มันเต็มไปด้วยข้อมูลที่มีประโยชน์ที่ทำให้มันเป็นจุดต่อยอดตามธรรมชาติสำหรับหัวข้อนี้

ตอนนี้เรามีความเข้าใจว่า microservice ของเราสามารถสื่อสารและประสานงานกันได้อย่างไรแล้ว แต่เราจะสร้างมันขึ้นมาตั้งแต่แรกได้อย่างไร? ในบทถัดไป เราจะดูวิธีนำ source control, continuous integration และ continuous delivery มาใช้ในบริบทของ microservice architecture

1 เรื่องนี้เปลี่ยนไปแล้ว โดยมีการรองรับ multidocument ACID transaction ถูกปล่อยออกมาเป็นส่วนหนึ่งของ Mongo 4.0 ผมเองยังไม่เคยใช้ feature นี้ของ Mongo ผมแค่รู้ว่ามันมีอยู่!

2 Martin Kleppmann, Designing Data-Intensive Applications (Sebastopol: O'Reilly, 2017).

3 Robert Kubis, "Google Cloud Spanner: Global Consistency at Scale," Devoxx, November 7, 2017, YouTube video, 33:22, https://oreil.ly/XHvY5 .

4 Hector Garcia-Molina and Kenneth Salem, "Sagas," ACM Sigmod Record 16, no. 3 (1987): 249–59.

5 เราทำจริง ๆ ไม่ได้เลย ผมลองมาแล้ว!

6 เรื่องนี้อยู่นอกขอบเขตของหนังสือเล่มนี้ แต่ Hector Garcia-Molina และ Kenneth Salem ได้สำรวจต่อไปว่า saga หลายตัวสามารถถูก "nest" กันเพื่อ implement process ที่ซับซ้อนกว่าได้อย่างไร หากต้องการอ่านเพิ่มเติมเกี่ยวกับหัวข้อนี้ ดู Hector Garcia-Molina et al., "Modeling Long-Running Activities as Nested Sagas," Data Engineering 14, no. 1 (March 1991: 14–18).

7 ดู Pat Helland, "Life Beyond Distributed Transactions: An Apostate's Opinion," acmqueue 14, no. 5 (December 12, 2016).

8 Gregor Hohpe and Bobby Woolf, Enterprise Integration Patterns (Boston: Addison-Wesley, 2003).

9 Bernd Ruecker, Practical Process Automation (Sebastopol: O'Reilly, 2021).