Sobes.tech
Middle

How were deviations handled when working with Kafka and REST (message did not arrive, service did not respond)?

sobes.tech AI

Answer from AI

When working with Kafka and REST for handling failures (for example, a message not received or a service not responding), the following approaches are used:

  • For Kafka:

    • Using acknowledgments (acks) from the broker to guarantee delivery.
    • Implementing retries for message sending upon errors.
    • Logging and monitoring errors.
    • Using the "Dead Letter Queue" (DLQ) scheme for messages that could not be delivered after several attempts.
  • For REST:

    • Timeouts and retries for requests upon failure.
    • Handling HTTP status errors (e.g., 5xx — server errors, 4xx — client errors).
    • Using the Circuit Breaker scheme to prevent service overload.
    • Logging and alerting on errors.

Example: if an error occurs when sending a message to Kafka, the service can retry several times with exponential backoff. If all attempts fail, the message is placed in the DLQ for later analysis. Similarly, when calling a REST API, if the service does not respond, the client retries the request a limited number of times and logs the error for further investigation.

How were deviations handled when working with Kafka… - sobes.tech