انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-024-L04

gRPC وProtocol Buffers

  • الدرس 4 من 6
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

define a service in .proto and understand the call types.

الموضوعات المخطط لها

  • A .proto file defines messages (typed, numbered fields) and services (methods).
  • Field numbers identify fields on the wire; never reuse or renumber them. Adding fields is backward compatible.
  • Four call types: unary, server streaming, client streaming, bidirectional streaming.
  • Set a deadline on every client call; deadlines propagate and replace ad-hoc timeouts.
  • In Spring, use a gRPC starter such as Spring gRPC or grpc-spring-boot-starter (verify the current choice and version before recording).
تفاصيل المخطط المبدئي

عرض عملي

proto
syntax = "proto3";
service InventoryService {
  rpc CheckStock (StockRequest) returns (StockReply);
}
message StockRequest { string sku = 1; int32 quantity = 2; }
message StockReply   { bool available = 1; int32 on_hand = 2; }

اختبر فهمك

Why never renumber a proto field?

أظهر الإجابة

Existing clients identify fields by number and would misread data.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.