Слияние main: перевод README на русский
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
# ingest-service (Go)
|
||||
|
||||
Status: implemented (MVP).
|
||||
Статус: реализован (MVP).
|
||||
|
||||
Responsibility:
|
||||
- Subscribe to MQTT topics `devices/{device_id}/telemetry`.
|
||||
- Validate/parse payload (device_id, sensor_type, value, timestamp).
|
||||
- Batch-write raw readings into ClickHouse `telemetry` table.
|
||||
- Publish a "new reading" event to RabbitMQ for rule-engine-service.
|
||||
Зона ответственности:
|
||||
- Подписка на MQTT-топики `devices/{device_id}/telemetry`.
|
||||
- Валидация/парсинг payload (device_id, sensor_type, value, timestamp).
|
||||
- Батч-запись сырых показаний в таблицу ClickHouse `telemetry`.
|
||||
- Публикация события «новое показание» в RabbitMQ для rule-engine-service.
|
||||
|
||||
Not this service's job: interpreting what a sensor reading *means* (thresholds,
|
||||
actions) — that belongs to rule-engine-service. This service only ingests and
|
||||
stores.
|
||||
Не входит в зону ответственности: интерпретация того, что *означает*
|
||||
показание датчика (пороги, действия) — это задача rule-engine-service. Этот
|
||||
сервис только принимает и сохраняет данные.
|
||||
|
||||
Note on `zone_id`: the telemetry payload carries `zone_id` directly (the
|
||||
publishing device/emulator is configured with its own zone), rather than
|
||||
ingest-service looking it up from PostgreSQL. This keeps ingest-service's
|
||||
dependencies limited to MQTT/ClickHouse/RabbitMQ, matching the architecture
|
||||
diagram in the root README. A real fleet where devices don't know their own
|
||||
zone would need a device-registry lookup (cached, like rule-engine caches
|
||||
rules) — that's a natural follow-up, not implemented yet.
|
||||
Про `zone_id`: payload телеметрии несёт `zone_id` напрямую (публикующее
|
||||
устройство/эмулятор само знает свою зону), а не ingest-service ищет его в
|
||||
PostgreSQL. Это удерживает зависимости ingest-service в рамках
|
||||
MQTT/ClickHouse/RabbitMQ, как и на диаграмме архитектуры в корневом README.
|
||||
Для реального парка устройств, которые не будут знать свою зону,
|
||||
понадобится lookup через реестр устройств (с кэшированием, как rule-engine
|
||||
кэширует правила) — это естественное развитие, пока не реализовано.
|
||||
|
||||
## Running
|
||||
## Запуск
|
||||
|
||||
```bash
|
||||
cd services/ingest-service
|
||||
@@ -28,7 +28,8 @@ go test ./...
|
||||
go build ./cmd/ingest-service
|
||||
```
|
||||
|
||||
Configuration is env-var driven (see the ingest-service section of the
|
||||
repo-root `.env.example`). Via `docker compose up ingest-service` it talks to
|
||||
the `mosquitto`/`clickhouse`/`rabbitmq` containers directly; connect from a
|
||||
local `go run` by exporting `MQTT_HOST=localhost`, `CLICKHOUSE_HOST=localhost`, etc.
|
||||
Конфигурация читается из переменных окружения (см. секцию ingest-service в
|
||||
корневом `.env.example`). Через `docker compose up ingest-service` сервис
|
||||
обращается напрямую к контейнерам `mosquitto`/`clickhouse`/`rabbitmq`; для
|
||||
локального запуска через `go run` выставь `MQTT_HOST=localhost`,
|
||||
`CLICKHOUSE_HOST=localhost` и т.д.
|
||||
|
||||
Reference in New Issue
Block a user