An Example in Context Mapping (ตัวอย่างใน Context Mapping)

Returning ไปยัง Example ที่ Discuss ใน Chapter 2 , " Strategic Design with Bounded Contexts and the Ubiquitous Language ," Question เกิด ขึ้นเกี่ยวกับ Location ของ Official Policy Type Remember ว่า มี Policy Types สาม Different ใน Three Different Bounded Contexts. ดังนั้น ที่ไหน does "Policy of Record" Live ใน Insurance Enterprise? มันเป็นไปได้ว่า มันอยู่ต่อ Underwriting Division เนื่องจาก นั่นคือ ที่ไหน มันกำเนิด สำหรับ Sake ของ Example นี้ มายัง Assume มันทำ ดังนั้น วิธีการใด Other Bounded Contexts Learn เกี่ยวกับ Its Existence?

Image

เมื่อ Component ของ Type Policy ถูก Issued ใน Underwriting Context มัน สามารถ Publish Domain Event Named PolicyIssued . Provided ผ่าน Messaging Subscription ใด Other Bounded Context อาจ React ต่อ Domain Event นั่น ซึ่ง สามารถ Include Creating Corresponding Policy Component ใน Subscribing Bounded Context.

Image

The PolicyIssued Domain Event จะ Contain Identity ของ Official Policy . Here มันคือ policyId . Any Components สร้าง ใน Subscribing Bounded Context จะ Retain That Identity สำหรับ Traceability Back ไปยัง Originating Underwriting Context. ใน This Example Identity ถูก Saved เป็น issuedPolicyId . หากมี Need สำหรับ More Policy Data กว่า PolicyIssued Domain Event ให้บริการ Subscribing Bounded Context สามารถ Always Query Back บน Underwriting Context สำหรับ More Information Here Subscribing Bounded Context ใช้ issuedPolicyId เพื่อ Perform Query บน Underwriting Context.


Enrichment versus Query-Back Trade-offs (ความมั่งคั่งกับ Trade-offs Query-Back)

บางครั้ง มี Advantage ไปยัง Enriching Domain Events ด้วย Enough Data เพื่อ Satisfy Needs ของ All Consumers บางครั้ง มี Advantage ไปยัง Keeping Domain Events Thin และ Allowing สำหรับ Querying Back เมื่อ Consumers Need More Data First Choice Enrichment ให้อนุญาต สำหรับ Greater Autonomy ของ Dependent Consumers หากความเป็นอิสระคือ Your Driving Requirement พิจารณา Enrichment

บน Other Hand มัน Difficult เพื่อ Predict ทุก Piece ของ Data ที่ All Consumers จะ Ever Need ใน Domain Events และ อาจมี Too Much Enrichment หากคุณ Provide มันทั้งหมด For Example มันอาจเป็น Poor Security Choice ไปยัง Greatly Enrich Domain Events. หากนั่นคือ Case Designing Thin Domain Events และ Rich Query Model ด้วย Security สำหรับ Consumers เพื่อ Request จาก อาจจะเป็น Choice คุณต้อง

บางครั้ง Circumstances จะ Call สำหรับ Balanced Blend ของ Both Approaches


Image

และ วิธีการไหน อาจ Query Back บน Underwriting Context Work? คุณ สามารถ Design RESTful Open Host Service และ Published Language บน Underwriting Context. Simple HTTP GET ด้วย issuedPolicyId จะ Retrieve IssuedPolicyData .

Image

คุณ Probably Wondering เกี่ยวกับ Data Details ของ Policy-Issued Domain Event. ผม จะ Provide Domain Event Design Details ใน Chapter 6 , " Tactical Design with Domain Events ."

Image

คุณ Curious เกี่ยวกับ อะไร Happened ไปยัง Agile Project Management Context Example? Straying จาก That ไปยัง Insurance Business Domain ให้อนุญาต คุณ เพื่อ Examine DDD ด้วย Multiple Examples นั่น ควรจะ มี Helped คุณ เพื่อ Grasp DDD ได้ดียิ่งขึ้น ไม่ต้องกังวล เรา จะ Return ไปยัง Agile Project Management Context ใน Next Chapter