Initial commit
This commit is contained in:
63
payload.md
Normal file
63
payload.md
Normal file
@@ -0,0 +1,63 @@
|
||||
## Cấu trúc Airflow → IDP
|
||||
|
||||
### 1. Request: Airflow → IDP
|
||||
|
||||
```json
|
||||
POST /process
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"request_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"file_path": "/data/bronze/incoming/qudtw216_signed_7829c.pdf",
|
||||
"file_type": "application/pdf",
|
||||
"callback_url": "http://airflow-webserver:8080/api/v1/dags/bronze_ingest_trigger/dagRuns/{run_id}/taskInstances/trigger_idp/callback"
|
||||
}
|
||||
```
|
||||
|
||||
**Giải thích field:**
|
||||
| Field | Bắt buộc | Ý nghĩa |
|
||||
|---|---|---|
|
||||
| `request_id` | ✓ | UUID để trace/idempotency |
|
||||
| `file_path` | ✓ | Path tuyệt đối trên HDFS |
|
||||
| `file_type` | optional | mime pdf/audio/json... |
|
||||
| `callback_url` | optional | Callback response |
|
||||
|
||||
---
|
||||
|
||||
### 2. Response
|
||||
|
||||
**Bước 1 — Nhận request:**
|
||||
```json
|
||||
HTTP 202 Accepted
|
||||
|
||||
{
|
||||
"request_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"status": "accepted",
|
||||
"job_id": "job-98765"
|
||||
}
|
||||
```
|
||||
|
||||
**Bước 2 — IDP gọi `callback_url` khi xong:**
|
||||
```json
|
||||
POST {callback_url}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"request_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"job_id": "job-98765",
|
||||
"status": "done",
|
||||
"output": { ... },
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4. Mã lỗi
|
||||
|
||||
| `code` | `description` |
|
||||
|---|---|
|
||||
| `FILE_NOT_FOUND` | `file_path` không tồn tại trên HDFS |
|
||||
| `FILE_READ_ERROR` | Lỗi network/permission khi đọc |
|
||||
| `FILE_STILL_WRITING` | File chưa ghi xong |
|
||||
| `PARSE_ERROR` | File đọc được nhưng lỗi khi xử lý nội dung |
|
||||
| `TIMEOUT` | Xử lý quá thời gian cho phép |
|
||||
Reference in New Issue
Block a user