Fixed two issues with Kafka connectivity:
1. Broker Address: Changed from 'localhost:9092' to 'kafka:29092'
- localhost:9092 was trying to connect to host machine, not Docker container
- kafka:29092 is the internal Docker network listener configured in docker-compose
- This allows the API container to reach Kafka via Docker's internal DNS
2. Kafka Producer Config: Removed invalid 'api_version_auto_discovery_interval_ms'
- Replaced with 'api_version=(2, 5, 0)' for explicit API version
- Confluent Kafka 7.5.0 uses API v2.5
- Prevents unrecognized config warnings
Docker-Compose Kafka Configuration:
KAFKA_ADVERTISED_LISTENERS:
- PLAINTEXT://kafka:29092 (for Docker internal communication)
- PLAINTEXT_HOST://localhost:9092 (for host machine access)
Result: Transactions now successfully published to Kafka!
POST /transaction → 200 OK with transaction_id
Message broker available and working
Co-authored-by: Copilot <[email protected]>