HomeInterview QuestionsHow do you handle exceptions, and where is the dat…

How do you handle exceptions, and where is the database connectivity?

🟡 Medium Conceptual Junior level
1Times asked
Aug 2026Last seen
Aug 2026First seen

💡 Model Answer

Exception handling in a streaming job should be proactive and fault‑tolerant. First, wrap the core processing logic in a try/except block. Log the exception with context (e.g., record ID, timestamp) to CloudWatch or a centralized log store. For transient errors (network timeouts, temporary DB unavailability), implement an exponential back‑off retry strategy with a maximum retry count. For unrecoverable errors, route the problematic record to a dead‑letter queue (e.g., SQS or Kinesis DLQ) so that the job can continue processing other records.

Database connectivity is typically managed through a connection pool. In Glue, you can use the built‑in JDBC connector and configure the pool size via the --extra-jars and --conf options. Store credentials securely in AWS Secrets Manager and fetch them at job start. The connection pool ensures that connections are reused across micro‑batches, reducing latency and avoiding connection exhaustion. Always close the pool gracefully in a finally block or rely on Glue’s automatic cleanup.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500