-
Notifications
You must be signed in to change notification settings - Fork 7
wheres-my-pizza #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
wheres-my-pizza #13
Conversation
wheres-my-pizza/README.md
Outdated
| ## Guidelines from Author | ||
|
|
||
| 1. Tests first. Spin up PostgreSQL + RabbitMQ with Testcontainers-go and create unit/contract/e2e tests that should fail until each step is implemented. | ||
| 2. Implement database schema and outbox publisher. | ||
| 3. Wire minimal consumer in `kitchen`; emit `Boxed`. | ||
| 4. Add `delivery` with payment simulation. | ||
| 5. Introduce retry exchange & DLQ. | ||
| 6. Write e2e tests with **Testcontainers-go**. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-check что нужно использовать что нет
wheres-my-pizza/README.md
Outdated
| - Event-driven architecture | ||
| - RabbitMQ: work-queue, fan-out, dead-letter / retry queues, manual **ACK/NACK + QoS** | ||
| - Exchange types & routing keys | ||
| - Transactional Outbox pattern (**events** table) + PostgreSQL | ||
| - Idempotent message processing (Inbox tables) | ||
| - Docker-Compose orchestration | ||
| - Unit, contract & end-to-end testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Слишком много
wheres-my-pizza/README.md
Outdated
| Build **wheres-my-pizza**, a three-service Go application that tracks a pizza order from placement to delivery. | ||
| All inter-service communication happens through RabbitMQ events—**no synchronous HTTP**. | ||
| A single transactional outbox keeps the DB and broker consistent; consumers stay idempotent via inbox tables. | ||
| The public REST API is **read-only** and lets clients query order status and full event history. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Слишком сложно, многие понятие студенту не открыты, твоя цель провести студента по образовательному пути, а не дать пощечину и почувствовать себя глупым
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может в optional добавить? чего много/сложно.
wheres-my-pizza/README.md
Outdated
| > you can’t polish your way out of bad architecture | ||
| > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| > you can’t polish your way out of bad architecture | |
| > | |
| > You can’t polish your way out of bad architecture. |
wheres-my-pizza/README.md
Outdated
|
|
||
| **Work Queue Pattern** | ||
| - One producer sends tasks to a queue | ||
| - Multiple consumers compete to receive tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Multiple consumers compete to receive tasks | |
| - Multiple consumers wait for the task to arrive, but only one receives it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Таблицы, сделай как в в техдизайне. Каждый сервис должен иметь свою таблицу
- Формат логов
- Нарисовать в виде ASCII схему взаимодейсвтия
wheres-my-pizza/README.md
Outdated
| ## Database Schema | ||
|
|
||
| ### Orders Table | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не хватает описания каждой таблицы, для чего где используется
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В таблицах используй простой text, а не varchar
wheres-my-pizza/README.md
Outdated
| create table order_status_log ( | ||
| "id" uuid primary key default gen_random_uuid(), | ||
| "created_at" timestamptz not null default now(), | ||
| order_id varchar(20) references orders(id), | ||
| "status" varchar(20), | ||
| "changed_by" varchar(50), | ||
| "changed_at" timestamp default current_timestamp, | ||
| "notes" text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order_id без кавычек
wheres-my-pizza/README.md
Outdated
| ## RabbitMQ Configuration | ||
|
|
||
| ### Exchanges and Queues Setup | ||
|
|
||
| ``` | ||
| Exchanges: | ||
| ├── orders_direct (type: direct, durable: true) | ||
| │ └── Routing Keys: | ||
| │ ├── kitchen.dine-in | ||
| │ ├── kitchen.takeout | ||
| │ └── kitchen.delivery | ||
| │ | ||
| └── notifications_fanout (type: fanout, durable: true) | ||
| └── Broadcasts to all subscribers | ||
|
|
||
| Queues: | ||
| ├── kitchen_queue (durable: true, x-max-priority: 10) | ||
| ├── kitchen_dine_in_queue (durable: true, x-max-priority: 10) | ||
| ├── kitchen_takeout_queue (durable: true, x-max-priority: 10) | ||
| ├── kitchen_delivery_queue (durable: true, x-max-priority: 10) | ||
| └── notifications_queue (durable: true, auto-delete: false) | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо объяснить, даже мне непонятно. Нужно раскрыть в чем отличие fanout от direct
wheres-my-pizza/README.md
Outdated
| ### Message Formats | ||
|
|
||
| **Order Message** | ||
| ```json | ||
| { | ||
| "order_number": "ORD_20241216_001", | ||
| "customer_name": "John Doe", | ||
| "customer_type": "vip", | ||
| "order_type": "delivery", | ||
| "table_number": null, | ||
| "delivery_address": "123 Main St, City", | ||
| "items": [ | ||
| { | ||
| "name": "Margherita Pizza", | ||
| "quantity": 1, | ||
| "price": 15.99 | ||
| } | ||
| ], | ||
| "total_amount": 15.99, | ||
| "priority": 10 | ||
| } | ||
| ``` | ||
|
|
||
| **Status Update Message** | ||
| ```json | ||
| { | ||
| "order_number": "ORD_20241216_001", | ||
| "old_status": "received", | ||
| "new_status": "cooking", | ||
| "changed_by": "chef_mario", | ||
| "timestamp": "2024-12-16T10:32:00Z", | ||
| "estimated_completion": "2024-12-16T10:42:00Z" | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Описать что за message, куда падает, кто читает
wheres-my-pizza/README.md
Outdated
| **Required Log Events:** | ||
| - Order received/processed/completed | ||
| - Worker connected/disconnected | ||
| - Status changes | ||
| - Error conditions and recoveries | ||
| - Performance metrics (processing times) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Где какой уровень использовать
wheres-my-pizza/README.md
Outdated
| #### Order Processing Flow: | ||
|
|
||
| 1. Order Service receives HTTP POST request | ||
| 2. Validates request data and calculates totals | ||
| 3. Stores order in PostgreSQL orders table | ||
| 4. Publishes order message to RabbitMQ | ||
| 5. Kitchen Worker consumes order from queue | ||
| 6. Updates order status to 'cooking' in database | ||
| 7. Simulates cooking process (configurable duration) | ||
| 8. Updates order status to 'ready' in database | ||
| 9. Logs completion and acknowledges message | ||
|
|
||
| Outcomes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не хватает консистенси: #### Order Processing Flow: и Orders:
Надо использовать хеши
wheres-my-pizza/README.md
Outdated
| #### Order Processing Flow: | ||
|
|
||
| 1. Order Service receives HTTP POST request | ||
| 2. Validates request data and calculates totals | ||
| 3. Stores order in PostgreSQL orders table | ||
| 4. Publishes order message to RabbitMQ | ||
| 5. Kitchen Worker consumes order from queue | ||
| 6. Updates order status to 'cooking' in database | ||
| 7. Simulates cooking process (configurable duration) | ||
| 8. Updates order status to 'ready' in database | ||
| 9. Logs completion and acknowledges message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если бы ты делал этот проект, ты бы много уточнял у Аяжан. А как валидировать, как высчитывать. Не хватает деталей
wheres-my-pizza/README.md
Outdated
| # Initialize database and queues | ||
| $ ./restaurant-system --setup-db --db="postgres://user:password@localhost/restaurant" | ||
| $ ./restaurant-system --setup-queues --rabbitmq="localhost:5672" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Где он хранит эти конфигурации?
atlekbai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Раздели задачи по фичам, чтобы в каждом задании были описаны элементы только одной части микросервиса: форматы сообщений, запросы, логи, флаги, примеры
- Добавь диаграммы, контекст и описание и этого маркдауна
Добавил учебный проект wheres-my-pizza — трёхсервисное Go-приложение, построенное на RabbitMQ + PostgreSQL с шаблоном «Transactional Outbox / Inbox». Цель - показать, как реализовать надёжную event-driven цепочку Order Placed => Kitchen => Delivery с ретраями, DLQ и идемпотентной обработкой.