Commit 39e6a79
committed
feat(queue): complete Gateway → Orchestrator queue integration
## Summary
Wire up the first stage of the queue pipeline: Gateway publishes land requests
to the queue, Orchestrator consumes and processes them. Queue infrastructure is
optional to maintain backward compatibility with existing integration tests.
## Why?
The orchestrator needs to process requests asynchronously through a multi-stage
queue pipeline. This establishes the foundation with reusable consumer infrastructure
that scales to 10+ queues.
## What?
**Consumer Infrastructure:**
- Add Consumer interface (Register/Start/Stop) for orchestrating multiple controllers
- Add Controller interface for queue message processing with per-subscription config
- Implement subscription lifecycle, automatic ack/nack, metrics, graceful shutdown
- Configurable shutdown timeout (timeoutMs parameter)
**Gateway:**
- Modify Land controller to publish requests to land_request queue after storage
- Add publisher metrics and error handling
- Queue infrastructure optional (controlled by QUEUE_MYSQL_DSN env var)
- Land API returns error if queue not configured
**Orchestrator:**
- Add Request controller to consume from land_request queue
- Wire up consumer with graceful shutdown in main.go
- Queue infrastructure optional (controlled by QUEUE_MYSQL_DSN env var)
- Server starts without queue for Ping API testing
**Entities:**
- Add Request JSON serialization (ToBytes/FromBytes)
**CLAUDE.md:**
- Extend time guideline to use int64 milliseconds for timestamps AND durations
- Add code style guidelines: use SugaredLogger, use interfaces for contracts
**Integration Tests:**
- All 3 service integration tests pass without MySQL
- Servers start successfully when queue infrastructure not configured
- Backward compatible with existing Ping API tests
## Test Plan
- 607 lines of consumer tests with channel-based synchronization
- Request entity serialization tests
- Gateway publisher integration tests
- Request controller tests with various states
- All unit tests pass
- All integration tests pass (gateway, orchestrator, speculator)1 parent f2b4750 commit 39e6a79
20 files changed
Lines changed: 1861 additions & 42 deletions
File tree
- consumer
- e2e_test
- entity
- example/server
- gateway
- orchestrator
- gateway/controller
- orchestrator/controller
- request
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments