> ## Documentation Index
> Fetch the complete documentation index at: https://control.datarelay.run/llms.txt
> Use this file to discover all available pages before exploring further.

# 실습 환경 준비

> 테스트용 HTTP 수신기와 가상 이벤트를 구성하고 Control과의 통신을 점검합니다.

# 실습 환경 준비

**목표:** 외부 제품 계정 없이도 DataRelay Control의 전달 결과를 직접 확인할 수 있는 HTTP 수신기를 준비합니다. 이 수신기는 실습 도구이며 Control의 Runtime 구성 요소가 아닙니다.

## 사전 조건

1. 실행 중인 Control 개발/평가 인스턴스와 Connector, Destination, Stream, Route 생성 권한
2. 실습용 서버의 Python 3.9 이상 및 `curl`
3. Control에서 접근 가능한 사설 테스트 네트워크 (수신기를 인터넷에 공개하지 마세요)

설치가 필요한 경우 [빠른 시작](https://control.datarelay.run/ko/getting-started/quickstart.md)을 먼저 수행하세요.

## 1. HTTP 수신기 실행

문서 저장소의 [examples/scenario\_receiver.py](https://github.com/datarelay-labs/datarelay-control-docs/blob/main/examples/scenario_receiver.py)를 `scenario_receiver.py`로 저장하거나 문서 저장소를 Clone합니다.

```bash theme={null}
python3 scenario_receiver.py --port 9011 --output received-9011.ndjson
```

기본 주소는 `http://127.0.0.1:9011/sink`입니다. Control이 다른 호스트나 Docker 컨테이너에서 실행된다면 **실제 접근 가능한 테스트망 IP**를 지정합니다.

```bash theme={null}
python3 scenario_receiver.py --bind 192.0.2.10 --port 9011 --output received-9011.ndjson
```

`192.0.2.10`은 설명용 주소입니다. 실제 실습 서버의 주소로 교체하고 방화벽에서 필요한 송신지만 허용하세요. Docker 내부의 `127.0.0.1`이 호스트 수신기를 가리킨다고 가정하지 않습니다.

## 2. Control 없이 수신기부터 확인

```bash theme={null}
curl --fail-with-body -X POST http://127.0.0.1:9011/sink \
  -H 'Content-Type: application/json' \
  --data '{"id":"receiver-self-test","user":{"email":"lab@example.invalid"},"message":"ready"}'
cat received-9011.ndjson
```

**정상 결과:** HTTP 200 및 `{"accepted": true}` 응답, NDJSON 파일에 `receiver-self-test` 이벤트 1건. 실패하면 먼저 IP·포트·방화벽 문제를 해결합니다.

## 3. Wizard에 사용할 가상 이벤트

```json theme={null}
{
  "id": "control-lab-001",
  "event_time": "2026-10-18T00:00:00Z",
  "user": { "name": "lab-user", "email": "lab@example.invalid" },
  "severity": "low",
  "message": "test event"
}
```

필요한 경우 Connector의 **Payload preview**, Wizard의 Sample에 입력합니다. Timestamp는 실습용 고정값입니다.

## 4. 두 개의 Destination이 필요한 경우

두 번째 터미널에서 실행합니다.

```bash theme={null}
python3 scenario_receiver.py --port 9012 --output received-9012.ndjson
```

Control의 `WEBHOOK_POST` Destination 2개는 Control에서 도달할 수 있는 IP와 서로 다른 포트(9011/9012)를 사용합니다.

## 5. HTTP 503 장애 재현

수신기를 종료한 뒤 다음과 같이 재실행합니다.

```bash theme={null}
python3 scenario_receiver.py --port 9011 --status 503 --output received-9011.ndjson
```

HTTP 503을 반환하고 성공 수신 기록을 남기지 않습니다. [전송 장애 진단과 복구](https://control.datarelay.run/ko/use-cases/delivery-incident.md)에서만 사용하세요. 정상 복구 시 `--status 200`으로 재실행하며 운영 Destination에는 적용하지 않습니다.

**다음 단계:** [Webhook 첫 이벤트 전송](https://control.datarelay.run/ko/use-cases/webhook-first-flow.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.