KodKode 6 · DATA Track

DATA

כל פרק בנוי על הקודם. לפני כל נושא — מה הוא פותר ולמה אנחנו זקוקים לו עכשיו.

CURRICULUM · 14 CHAPTERS
1
CHAPTER 01
Docker — קונטיינרים, Images ו-Compose
DOCKER
למה אנחנו צריכים את זה?
קוד שעובד אצלי לא תמיד עובד אצל מישהו אחר — גרסת Python שונה, ספרייה חסרה, MySQL שלא מותקן. Docker אורז את האפליקציה יחד עם כל מה שהיא צריכה לסביבה מבודדת שרצה אותו דבר בכל מחשב. מכאן והלאה כל שירות בקורס — DB, Kafka, Elasticsearch — ירוץ בקונטיינר.
Containers & Images
Container vs Virtual Machine Image vs Container Registry, Docker Hub, Repository Tag, Digest, Official Images Image Variants (slim, alpine) Image Layers
Container Lifecycle
create, start, stop, remove Main Process & Exit Codes Writable Layer & Ephemeral Data docker run (-d, -it, --name, --rm) ps, exec, logs, inspect (--format) cp, diff, history, version, info
Ports & Volumes
Port Publishing (-p, -P, bind address) EXPOSE vs Publish Bind Mounts, Named Volumes Read-only Mounts Mounting over Existing Paths Data Persistence
Networks
User-defined Bridge Networks Container DNS & Network Aliases localhost inside a Container Network Connect / Disconnect
Dockerfile
FROM, WORKDIR, COPY, RUN CMD, ENTRYPOINT, ENV, ARG, EXPOSE Exec Form vs Shell Form Build Time vs Run Time Layer Cache & Instruction Ordering
docker build
-t, -f, --build-arg --no-cache, --progress=plain Image Tagging Build Context, .dockerignore
Packaging Python Apps
Python Scripts, requirements.txt pip install in Images FastAPI Server (uvicorn, 0.0.0.0 vs 127.0.0.1) python -m, PYTHONUNBUFFERED os.getenv, -e, --env-file, ENV, ARG
Docker Compose
compose.yaml (services, image, build, ports, volumes, command) Project Name & Service DNS environment, env_file, ${VAR}, .env up, down, down -v, build, --force-recreate ps, logs, exec, run, config
MySQL in Docker
Official MySQL Image (MYSQL_* variables) /var/lib/mysql /docker-entrypoint-initdb.d, first initialization Healthcheck & depends_on (service_healthy) Started vs Ready
Multi-service Projects
One-off Jobs vs Long-running Services run --rm, profiles, restart, --no-deps Separate Dockerfiles & Contexts Shared Named Volume between Services Read-only Bind Mount for Input Dependency Audit per Service
Troubleshooting
status, exit code, logs, exec, effective config Local Run vs Container Run MySQL Errors (2003, 1045, 1044, 1049, 1146)
▸
פרויקטים: Field Equipment Inventory · Automated File Processing Pipeline
2
CHAPTER 02
ניתוח נתונים עם NumPy ו-Pandas
DATA ANALYSIS
למה אנחנו צריכים את זה?
נתונים אמיתיים מגיעים מלוכלכים: ערכים חסרים, כפילויות, טקסט לא אחיד, תאריכים ששמורים כמחרוזות. לולאות Python על מאות אלפי שורות איטיות ומסורבלות. NumPy ו-Pandas נותנים פעולות וקטוריות על טבלאות שלמות — לחקור, לנקות, להמיר ולסכם נתונים בכמה שורות קוד.
NumPy
ndarray Creation (array, arange) shape, dtype, ndim Indexing & Slicing Vectorized Operations, Boolean Mask Aggregations (sum, mean, max), np.nan Lists vs Arrays
Series & DataFrame
Series, DataFrame Creation Index & Columns df.copy() read_csv, to_csv
Exploration
head, tail, sample info, describe, dtypes Column Selection loc vs iloc (inclusive vs exclusive ranges) unique, nunique, value_counts
Filtering & Sorting
Boolean Mask Filtering Combining Conditions (&, |, ~) isin, between sort_values, nlargest, nsmallest In-place vs New-object Behavior
Data Cleaning
Missing Values (isna, notna, dropna, fillna, replace) Duplicates (duplicated, drop_duplicates) Text Cleaning (str.strip, lower, upper, title, replace, contains) Category Normalization Renaming Columns
Types & Quality
to_numeric (errors=coerce), astype to_datetime (format), NaT Invalid Values (negative, zero, outliers) Chronological Consistency Checks Before/After Quality Reports
Transformation
Calculated Columns Date Accessor (.dt) map with Dictionaries apply vs Vectorized Operations
GroupBy & Aggregation
GroupBy (mean, sum, median, size, count) size vs count Named Aggregation (agg) Multi-key GroupBy Ranking, transform
▸
תרגול: Exploration Script · Cleaning Script · CSV-to-CSV Cleaning & Transformation Workflow
3
CHAPTER 03
C# — יסודות I: מ-Python ל-C#
C# BASICS
למה עוברים ל-C#?
Python מצוינת לסקריפטים ולנתונים, אבל מערכות Backend גדולות צריכות בדיקת טיפוסים לפני ההרצה, ביצועים וכלים לבניית שירותים. C# ו-.NET נותנים את כל זה — הקומפיילר תופס טעויות עוד לפני שהקוד רץ. על הבסיס הזה נבנה את כל צד השרת של הקורס.
.NET Platform
C# vs .NET SDK vs Runtime vs CLR Compilation (IL, JIT) vs Python Bytecode dotnet new, build, run Program.cs & .csproj Top-level Statements vs Main
Variables & Types
Declaration, Initialization, Assignment var, const int, long, double, decimal, bool, char, string string vs char Value Types vs Reference Types
Input & Operators
ReadLine, Write, WriteLine String Interpolation Arithmetic, Comparison & Logical Operators Casting, Parse, TryParse Input Validation with TryParse
Control Flow
if, else if, else, switch Nested Conditions for, while, foreach break, continue, Nested Loops Off-by-one & Infinite Loop Errors
Methods
Parameters, Arguments, Return Types, void Block Scope Parameter Passing (by value, including references) static Methods public vs private (basic)
Collections
Arrays (fixed size, Length, default values) IndexOutOfRangeException List<T> (Add, Remove, Count, Contains) Array vs List<T>
Errors
Compile-time vs Runtime vs Logic Errors string Behavior as Reference Type
Console Apps
Receipt Generator Trip Cost Estimator Number Guessing Game Student Grades Analyzer
▸
פרויקט מסכם: Inventory Order Fulfillment · אופציונלי: Scheduling with Overlap Detection
4
CHAPTER 04
C# — יסודות II: null, Dictionary, Exceptions ו-Debugging
C# CORE
למה אנחנו צריכים את זה?
תוכנית אמיתית פוגשת קלט שבור, ערכים חסרים ומפתחות שלא קיימים — ובלי טיפול היא קורסת. בפרק הזה נלמד לייצג "אין ערך" בבטחה, לשמור נתונים לפי מפתח, לזרוק ולתפוס שגיאות בצורה מבוקרת, ולמצוא באגים עם Debugger במקום לנחש.
Null Handling
null Nullable Value Types (T?, HasValue, Value) Null-conditional Operator Null-coalescing Operator Null-coalescing Assignment
enum
members, underlying type default numbering, explicit values cast to int, Enum.GetValues
Dictionary<TKey, TValue>
Add, indexer, ContainsKey TryGetValue, Remove Counters & Lookups
Parameter Passing
Passing by Value Reference Type by Value (mutation vs reassignment) out, ref TryParse & TryGetValue Pattern Method Overloading (signature, resolution)
Exceptions
Runtime Errors vs Logical Bugs try/catch, finally, throw Exception Hierarchy & catch Order ArgumentOutOfRange, InvalidOperation, KeyNotFound Propagation, Call Stack & Stack Trace Validation vs Exceptions
Debugging
Breakpoint, Continue Step Over, Step Into, Step Out Watch, Call Stack Debugging Workflow
Console Apps
Student Results Manager ATM Transaction Simulator
▸
פרויקט מסכם: Login Event Analysis · אופציונלי: Status Tracking and State Transitions
5
CHAPTER 05
תכנות מונחה עצמים ב-C#
OOP
למה אנחנו צריכים את זה?
ככל שהתוכנית גדלה, נתונים ופונקציות מתפזרים בכל מקום וכל שינוי שובר משהו אחר. תכנות מונחה עצמים מאגד מצב והתנהגות לאובייקט אחד, שומר על החוקים שלו מבפנים, ומאפשר להחליף מימושים בלי לשנות את הקוד שמשתמש בהם.
Classes & Objects
Object, Class, Instance State & Behavior, Fields, Methods new, this Instance vs static Members Reference Semantics of Class Variables
Encapsulation
public, private, protected, internal Properties (get, set, value, backing field) Auto-implemented, private set, Read-only init, required Validation in Setters
Constructors
parameterless, parameterized overloading, chaining Invariants
Composition
has-a, uses-a delegation
Inheritance
base class, derived class, base(...) protected virtual & override Method Hiding (new) sealed
Polymorphism & Abstraction
Compile-time vs Runtime Type runtime dispatch, base-class references Abstract Classes & Abstract Methods Abstraction
Interfaces
contracts, implementing interface references Interface vs Abstract Class Composition vs Inheritance vs Interfaces
Console Apps
Workshop Registration Tracker Support Ticket Notification Center
▸
פרויקט מסכם: Access Pass System · אופציונלי: Device Workflow with Controlled State Transitions
6
CHAPTER 06
Software Design, SOLID ו-Dependency Injection
DESIGN
למה אנחנו צריכים את זה?
קוד יכול לעבוד נכון ועדיין להיות קשה לשינוי: מחלקה שעושה הכל, תלויות שנוצרות עם new בכל מקום, ערכים קשיחים בתוך הקוד. בפרק הזה נלמד לזהות את הבעיות האלו, לפרק אחריות לפי SOLID, להזריק תלויות מבחוץ ולהוציא הגדרות לקונפיגורציה.
Software Design
Design vs Functional Correctness Maintainability Code Smells (Duplicated Code, Magic Numbers, Long Method) Coupling, Cohesion Refactoring & Verifying Refactoring
SOLID
SRP, OCP LSP (contracts, pre/postconditions) ISP (role interfaces, fat interfaces) DIP When Not to Apply Each Principle
Dependency Injection
Dependencies & Direct Instantiation Tight Coupling, Inversion of Control Constructor Injection, readonly Dependencies Manual DI, Object Graph Composition Root
DI Container
ServiceCollection, BuildServiceProvider GetRequiredService, Registration & Resolution Transient, Scoped, Singleton, Scopes Captive Dependency, ValidateScopes, ValidateOnBuild Service Locator Anti-pattern
Configuration
Hardcoded Configuration Problems appsettings.json, Keys & Hierarchy IConfiguration (GetValue, GetSection) Environment Variables (__ nesting), Command-line Configuration Precedence
Options & Generic Host
Strongly Typed Settings & Binding Options Pattern (IOptions<T>) Options Validation (Data Annotations) Host.CreateApplicationBuilder
Console Apps
Library Fines Refactoring Lab Pet Boarding Quote Desk Study Session Planner
▸
פרויקט מסכם: Ride Settlement System · אופציונלי: Comment Moderation
7
CHAPTER 07
C# מתקדם — LINQ, קבצים, Logging ו-async
C# ADVANCED
למה אנחנו צריכים את זה?
האפליקציות שלנו צריכות לעבד אוספי נתונים, לשמור אותם לקבצים, לדווח על תקלות ולבצע עבודה ארוכה בלי לתקוע הכל. בפרק הזה נאסוף את כלי השפה שהופכים קוד כזה לקצר ובטוח — Generics, Lambda ו-LINQ — ונוסיף קבצים ו-JSON, טיפול שגיאות מרכזי, Logging, async ו-BackgroundService.
Generics
type parameter, type argument type inference, type safety Generic Methods & Classes Multiple Type Parameters Generic Interfaces
Delegates & Lambda
Delegates, Method Groups Func, Action Lambda Expressions, Closures Callbacks, Higher-order Methods Delegate vs Interface
LINQ
Where, Select OrderBy, OrderByDescending, ThenBy FirstOrDefault, Any, Count, Sum, Average GroupBy (IGrouping), Method Chaining Deferred vs Immediate Execution (ToList) Common LINQ Mistakes
Files & Paths
Absolute vs Relative Paths Working Directory, AppContext.BaseDirectory Path.Combine, File & Directory Operations WriteAllText, AppendAllText, ReadAllText Encoding, Paths as Configuration
Streams & JSON
StreamReader, StreamWriter IDisposable, using, try/finally File.* vs Streams System.Text.Json, JsonSerializerOptions JsonException, JSON vs Data Validity
Repository Pattern
Separation of Concerns interface, file-based, in-memory Domain Service vs Infrastructure
Error Boundary
Failure Categories Validation Results vs Exceptions Custom Exception, throw vs throw ex Exception Filters, InnerException Application Exception Boundary, Exit Codes
Logging
Logging vs Console.WriteLine ILogger<T>, Log Levels Message Templates, Structured Logging Exception Logging Sensitive Data in Logs
async / await
Sync vs Async vs Parallel Task, Task<T>, async & await async Does Not Mean New Thread Task.Delay, FromResult, CompletedTask async Main, Async File I/O & Repository Exceptions in Tasks, Fire-and-forget
Cancellation & Background
CancellationTokenSource, CancellationToken CancelAfter, OperationCanceledException Ctrl+C, Timeouts, Cleanup BackgroundService, AddHostedService Graceful Shutdown, IHostApplicationLifetime
Console Apps
Telemetry Analyzer (LINQ & Lambda) File Archive (TXT/JSON) Async Data Processor
▸
פרויקט מסכם: JSON and TXT Data Hub · אופציונלי: Periodic File Intake with BackgroundService
8
CHAPTER 08
ASP.NET Core Web API
WEB API
למה אנחנו צריכים שרת?
עד עכשיו כתבנו אפליקציות Console שרק מי שמריץ אותן יכול להשתמש בהן. Web API פותח את הלוגיקה לכל לקוח ברשת דרך HTTP. ASP.NET Core נותן את התשתית — ניתוב, קישור נתונים, ולידציה, קודי סטטוס ו-Middleware — ומעליה נבנה שכבות נקיות.
Application Startup
Web SDK Project Structure launchSettings.json, Program.cs WebApplicationBuilder, Service Registration Build() and Run() Request Pipeline, Environments
Controllers & Routing
ControllerBase, Actions, [ApiController] [Route], [controller], HTTP Method Attributes Route Parameters & Constraints Action Selection Constructor Injection in Controllers
Model Binding & Results
[FromRoute], [FromQuery], [FromBody] JSON Request Bodies, Complex Types IActionResult, ActionResult<T> Ok, NotFound, BadRequest, CreatedAtAction
OpenAPI & Testing
OpenAPI, Swagger UI ProducesResponseType Testing with curl
CRUD & Validation
GET, POST, PUT, DELETE Data Annotations ([Required], [Range]...) Automatic 400 (ModelState), ValidationProblemDetails Nullable Reference Types & Required Business vs Annotation Validation
Status Codes
200, 201 with Location, 204 400, 404, 409, 500 Status Codes for Empty Collections
Layers
Controller vs Service vs Repository JSON-file Repository & Safe Writes Options for Paths and Settings DI Lifetimes, Scoped inside Singleton Pass-through Layers
DTOs
Request DTO, Response DTO API Contracts, Over-posting Create vs Update DTOs Manual Mapping When DTOs are Not Needed
Middleware
HttpContext, RequestDelegate, next Short-circuiting, Ordering UseMiddleware, InvokeAsync Cross-cutting Concerns
Global Exception Handling
UseExceptionHandler, AddProblemDetails IExceptionHandler, ProblemDetails, traceId Safe Error Responses Logging Exceptions Once Expected Failures vs Exceptions
REST APIs
System Information, Technical Notes Training Courses Catalog Promo Code Redemption Employee Directory, Warranty Lookup
▸
פרויקט מסכם: Registry API · אופציונלי: Append-only History API with Sensitive Value Masking
9
CHAPTER 09
SQL ו-MySQL
SQL
למה אנחנו צריכים DB?
קבצי JSON לא מחזיקים מעמד כשיש הרבה נתונים, הרבה משתמשים וקשרים בין ישויות. מסד נתונים רלציוני שומר נתונים בטבלאות עם מפתחות ואילוצים שמונעים נתונים שגויים, ו-SQL מאפשר לשלוף, לסנן, לקבץ ולחבר טבלאות בשאילתה אחת.
Relational Model
Tables, Rows & Columns Primary Keys, Composite Keys Foreign Keys, Parent / Child Tables One-to-Many, Many-to-Many, Self-Referencing SQL Data Types (DECIMAL) DESCRIBE, SHOW CREATE TABLE
Querying
SELECT, FROM, AS WHERE, AND, OR, NOT LIKE, IN, BETWEEN IS NULL, IS NOT NULL ORDER BY, LIMIT, DISTINCT
Modifying Data
INSERT, UPDATE, DELETE CREATE TABLE
Aggregations
COUNT(*), COUNT(column), COUNT(DISTINCT) SUM, AVG, MIN, MAX ROUND, COALESCE, YEAR GROUP BY, HAVING, WHERE vs HAVING Logical Order of Query Processing
JOINs
INNER, LEFT, RIGHT JOIN ON vs WHERE Joining Three or More Tables Fan-out & COUNT DISTINCT Anti-join (LEFT JOIN + IS NULL) Self JOIN, CROSS JOIN
Schema Design
NOT NULL, DEFAULT, UNIQUE, AUTO_INCREMENT FOREIGN KEY, ON DELETE (RESTRICT, CASCADE, SET NULL) Designing a Schema from Requirements Loading Data in Dependency Order Testing Constraints
10
CHAPTER 10
Entity Framework Core
EF CORE
למה אנחנו צריכים ORM?
לכתוב SQL ידנית בכל מקום בקוד C# זה הרבה קוד חוזר, מחרוזות שבירות והמרה ידנית של שורות לאובייקטים. EF Core הוא ORM: אנחנו עובדים עם מחלקות ו-LINQ, והוא מתרגם ל-SQL, עוקב אחרי שינויים ומנהל את מבנה הטבלאות דרך Migrations.
ORM & Setup
ORM Concept & Rationale Entity, Database Providers EF Core Packages, dotnet-ef Tool DbContext, DbSet<TEntity>, DbContextOptions UseMySql, Connection Strings Mapping Conventions
Code First & Migrations
Add, Update, Up, Down Model Snapshot, __EFMigrationsHistory Pending & Reverting Migrations Runtime vs Design Time
Database First
dbcontext scaffold --output-dir, --context, --table, --force partial Classes for Scaffolded Models
CRUD & Change Tracking
Add, Remove, Find, FirstOrDefault, ToList SaveChanges Detached, Added, Unchanged, Modified, Deleted Entry, Identity Resolution Viewing Generated SQL
EF Core in ASP.NET Core
AddDbContext, Scoped lifetime DbContext Not Thread-safe appsettings.json, User Secrets ASPNETCORE_ENVIRONMENT --project, --startup-project
Relationships & Configuration
PK, FK & Navigation Properties One-to-Many, Required vs Optional Cascade Delete, Relationship Fix-up Fluent API (HasOne, WithMany, HasForeignKey) HasIndex, IsUnique, Precision IEntityTypeConfiguration<T>
Organizing EF Core
Entity vs DTO Repository vs Direct DbContext DbUpdateException, 409 Conflict Clean Project Structure Migration Discipline
LINQ to EF Core
Where, OrderBy, Select, Take, Skip Count, Any, Sum, GroupBy, Join IQueryable vs IEnumerable Expression Trees, Materialization ToQueryString, SQL Logging Client vs Server Evaluation
Related Data & Efficiency
Include, ThenInclude Projection Explicit & Lazy Loading N+1 Problem & Solutions AsNoTracking ToListAsync, CancellationToken
Projects
Pantry Inventory Recipe Notebook Sales Insights Garden Plot Allocation
▸
פרויקט מסכם: Feedback API from Scratch — Relationships, Migrations, Seed Data, LINQ Aggregations
11
CHAPTER 11
MongoDB ו-Redis
NOSQL & CACHE
למה אנחנו צריכים את זה?
לא כל נתון מתאים לטבלאות: מסמכים עם מבנה משתנה ומערכים מקוננים דורשים הרבה JOINים ב-SQL. MongoDB שומר מסמכים שלמים. ובנוסף — שאילתה שחוזרת אלפי פעמים לא צריכה לפגוע ב-DB בכל פעם: Redis שומר תוצאות בזיכרון עם תפוגה ומחזיר אותן מיד.
Document Model
SQL vs NoSQL Decision Factors Database / Collection / Document / Field Embedded Documents & Arrays Embedded vs Referenced Design JSON vs BSON, ObjectId & _id
mongosh
MongoDB in Docker use, insertOne, find updateOne with $set, deleteOne countDocuments
MongoDB C# Driver
MongoClient, IMongoCollection<T> [BsonId], [BsonRepresentation], [BsonElement] InsertOneAsync, Find, UpdateOneAsync ReplaceOneAsync, DeleteOneAsync Invalid ObjectId Handling Options & DI, Repository
Queries & Aggregation
$gt, $gte, $lt, $lte, $ne, $in, $exists $and, $or, Implicit AND Sort, Skip, Limit (Pagination) Tie-breaker Sorting, Counting $match, $group, $sort, $project
Indexes & Atlas
single, compound Indexes COLLSCAN vs IXSCAN, explain CreateIndexModel MongoDB Atlas (cluster, IP access list, SRV) mongoimport, User Secrets
Redis Basics
Use Cases (caching, temporary state, counters) When Redis is Unnecessary Redis in Docker, redis-cli SET, GET, EXISTS, DEL, Key Naming TTL (EXPIRE, EX, KEEPTTL) INCR, INCRBY, DECR
StackExchange.Redis
ConnectionMultiplexer, IDatabase StringSetAsync, StringGetAsync KeyExistsAsync, KeyDeleteAsync Storing JSON in Redis Singleton multiplexer in DI
Caching in Practice
Source of Truth, Cache-Aside Cache Hit / Miss, TTL Selection Stale Data, Invalidation, Eventual Consistency Failure Handling & Graceful Degradation Connection Resilience SET NX EX, Race Conditions
Web APIs
System Event Journal Marathon Results Explorer Museum Audio Guide Sessions Transit Arrival Cache
▸
פרויקט מסכם: Availability API — MongoDB (Aggregation, Index) + Redis (Cache-Aside, TTL, Invalidation)
12
CHAPTER 12
Apache Kafka — Event Streaming
STREAMING
למה אנחנו צריכים את זה?
כששירות קורא לשירות אחר ב-HTTP ומחכה — אם השני איטי או נפל, גם הראשון תקוע. Kafka מפריד ביניהם: המפיק כותב אירוע ללוג עמיד, וכל צרכן קורא אותו בקצב שלו, גם אחרי שעות, ואפשר אפילו לקרוא את האירועים מחדש.
Messaging Concepts
Sync vs Async, Temporal Coupling Message vs Event, Message Broker Message Queue, Publish/Subscribe Event-Driven Architecture, Event Streaming Kafka vs HTTP vs Queue
First Steps
Producer, Topic, Consumer, Record Kafka in Docker (KRaft) kafka-topics.sh (--create, --list, --describe) Console Producer & Consumer
Confluent.Kafka (C#)
ProducerConfig, ProduceAsync, DeliveryResult ConsumerConfig, GroupId, AutoOffsetReset Subscribe, Consume, Close Graceful Consumer Shutdown JSON Message Contracts
Brokers & Clusters
Broker, Cluster, Replication & Leader Bootstrap Servers, Metadata Listeners & Advertised Listeners Container DNS & Listener Configuration
Partitions & Ordering
Partitions, Offsets Message Keys, Default Partitioner Ordering per Partition Choosing a Message Key
Consumer Groups
Partition Assignment, Rebalancing Committed Offsets, Consumer Lag __consumer_offsets Replay, Retention, Resetting Offsets
Kafka with Python
Producer, Consumer, delivery callbacks poll, flush, error handling C#-Python Interoperability Field Name Contract Mismatches
Kafka in Backend Apps
Consumer as BackgroundService Producer in DI, KafkaOptions 202 Accepted Transport vs Processing Separation
Delivery & Idempotency
Manual Commit At-Most-Once, At-Least-Once, Exactly-Once Idempotent Processing Idempotency in MongoDB (unique index, upsert) Poison Messages vs Transient Failures, Retry
Compose & Readiness
healthchecks, depends_on conditions init service for topic creation Dockerfile for ASP.NET Core Started vs Ready Pipeline Troubleshooting
Projects
Doorbell Event Feed Live Quiz Scoreboard Newsletter Subscription Pipeline
▸
פרויקט מסכם: End-to-end Pipeline — Python Ingestion, Kafka, C# Consumers, MongoDB, Redis, Docker Compose
13
CHAPTER 13
Elasticsearch ו-Observability
SEARCH & LOGS
למה אנחנו צריכים את זה?
חיפוש טקסט חופשי עם LIKE ב-SQL איטי ולא יודע לדרג תוצאות לפי רלוונטיות. ובמערכת שרצה בייצור, לוגים מפוזרים בקבצים לא עוזרים לחקור תקלה. Elasticsearch בונה אינדקס הפוך לחיפוש מהיר ומדורג, ו-Kibana הופכת לוגים מובנים לגרפים ולדשבורדים.
Search Concepts
Why Elasticsearch Elasticsearch vs SQL, MongoDB, Redis Document, Field, Index, Mapping Inverted Index Shards & Replicas, Near Real-time
Text Analysis & Mapping
Analyzer, Tokenizer, Token Filter, _analyze text vs keyword, Multi-fields numeric, date, boolean Types Dynamic vs Explicit Mapping
REST API & Dev Tools
Elasticsearch & Kibana in Docker Kibana Dev Tools Console _cat APIs & Cluster Health index, get, _update, delete, _bulk, _count
Query DSL
match_all, match, match_phrase term, terms, range, exists, bool Relevance Scoring (_score) Sorting, from / size _source Filtering, track_total_hits
Aggregations
bucket vs metric terms, date_histogram sub-aggregations, size 0, doc_count
C# Client
ElasticsearchClient & settings fluent & object-initializer APIs response handling bulk indexing from C#
Structured Logging
ILogger<T> levels & templates scopes, correlation ID, EventId Sensitive Data, Log Noise Log Schema, ECS Fields
Log Pipeline
event, formatter, sink, delivery, search Buffering & Backpressure Data Streams Elastic.Serilog.Sinks Elasticsearch Outage & Log Loss
Kibana
Data Views, Time Picker Discover, filters, saved search KQL Lens Visualizations Dashboards, Incident Investigation
Projects
Podcast Episode Search Cafeteria Order Batch Processor Service Activity Analyzer
▸
פרויקט מסכם: Search API — Explicit Mapping, Query DSL, Aggregations ו-Structured Logs ל-Data Stream
14
CHAPTER 14
RabbitMQ — תורי הודעות וניתוב
MESSAGING
למה אנחנו צריכים את זה?
יש עבודה שלא צריכה לקרות בתוך הבקשה — עיבוד מסמך, שליחת התראה. אם נבצע אותה מיד, המשתמש מחכה וכל תקלה מפילה את הבקשה. RabbitMQ מקבל את המשימה לתור, מנתב אותה לצרכן המתאים ומוודא שהיא לא הולכת לאיבוד גם אם צרכן נפל באמצע.
Why RabbitMQ
Message Broker Offloading Work from Request Handling When RabbitMQ is Unnecessary RabbitMQ vs Kafka (queue vs log model)
Core Model
Producer, Consumer, Queue Exchange, Binding, Routing Key Message Path Connection & Channel, Default Exchange
Setup & Management UI
RabbitMQ in Docker AMQP vs Management ports, virtual host queues, connections, get/publish messages
RabbitMQ.Client
ConnectionFactory, QueueDeclareAsync BasicPublishAsync AsyncEventingBasicConsumer BasicConsumeAsync
Work Queues
Competing Consumers, Round-robin Manual ack (BasicAckAsync) Redelivery, Ready vs Unacked Prefetch (BasicQosAsync)
Exchanges & Routing
Direct, Fanout, Topic (* and #) Two Queues vs Two Consumers Server-named, Exclusive, Auto-delete Queues mandatory Flag (Basic.Return) Binding Key Design, Audit Queue
Reliability
Durable Queues vs Persistent Messages Publisher Confirms vs Consumer Ack Nack, Reject & Requeue Redelivery Loop Risk Idempotent Consumers
Python & Interop
pika (BlockingConnection, basic_consume) confirm_delivery, UnroutableError topology & message contracts Idempotent Topology Declaration
ASP.NET Core Integration
singleton Connection, Channel per operation 202 Accepted, 503 Worker as BackgroundService Channel Ownership
Projects
Simple Background Task Queue Message Routing Playground Document Processing Workers
▸
פרויקט מסכם: Multi-channel Dispatcher — Topic Routing, C# & Python Consumers, Publisher Confirm