# System Robustness Improvements

## Context
A review of the project revealed missing initialization scripts and lack of graceful shutdown handling, which are critical for production stability and deployment.

## Changes
1.  **Database Initialization (`scripts/init_db.sql`)**:
    *   Created a SQL script to initialize the `rcu_action` schema and `rcu_action_events` table.
    *   Added indexes for performance optimization (`ts_ms`, `hotel_id`, `room_id`, `direction`, `cmd_word`, `action_type`).
    *   Added a composite index (`hotel_id`, `room_id`, `ts_ms DESC`) for common query patterns.

2.  **Graceful Shutdown (`src/index.js`)**:
    *   Implemented `SIGTERM` and `SIGINT` signal handlers.
    *   Ensures resources are closed in order: Kafka Consumer -> Redis Client -> Database Pool.
    *   Prevents data corruption or zombie connections during container restart/stop.

3.  **Error Handling Enhancements**:
    *   Decoupled `startErrorRetryWorker` from the main bootstrap chain to prevent blocking/crashing on startup.
    *   Added `try/catch` block in `handleMessage` to ensure errors are logged and bubbled up to the retry mechanism properly.
