العقود للرسائل
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
apply contracts to Kafka events.
الموضوعات المخطط لها
- A message is also an API: the producer must not break consumers' parsing.
- The consumer defines the message shape it reads (
OrderPlacedwithorderId,lines); the producer verifies it can generate it. - Pact message pacts and Spring Cloud Contract messaging both support this; verify the version and the supported broker setups before recording.
- Combine with a schema registry for compatibility rules (see the messaging modules).
تفاصيل المخطط المبدئي
عرض عملي
a contract for OrderPlaced: required orderId (string), totalCents (integer); provider test builds the real event and checks it.
اختبر فهمك
Why test a message contract?
أظهر الإجابة
Consumers parse fields; renaming one breaks them silently.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.