Tell us how you have used Kafka or another message broker in a microservices architecture, what problems you solved with it, and how you ensured reliable message delivery and processing.
Asked at
AI answer
Kafka is useful for asynchronous event exchange between services—for example, publishing an event when an order is created so that payment and notification services can process it independently. This reduces synchronous coupling, helps smooth load spikes, and allows events to be read again.
For reliability, the partitioning key is usually chosen based on the required processing order, replication is enabled, and write acknowledgments are configured correctly (acks=all, idempotent producer). The consumer commits the offset after successful processing; in case of a failure, the message will be read again, so the handler must be idempotent—for example, by deduplicating events by ID. For transient errors, use a limited number of retries with a delay; for unrecoverable errors, use a DLQ and monitoring. If the database write and event publication need to be coordinated, use a transactional outbox. In practice, the usual goal is at-least-once delivery with safe reprocessing, rather than relying on an end-to-end exactly-once guarantee.
Also asked at WhoAI
- Describe the lifecycle of a Spring bean.
- Could you give me an idea of your salary expectations, both your minimum and your preferred amount?
- What work schedule and format are comfortable for you? Would you consider a 5/2 schedule with a full workload of about 160 hours per month, remote work on Moscow time, a hybrid format while living in [locality] or [region], or working from an office in [locality]? Do you have any scheduling constraints or preferences?
- Can you explain the main difference between unit tests and integration tests, and in what situations do you use Mockito when writing unit tests?
- How do you approach query optimization in PostgreSQL when using JPA Hibernate, and what tools or techniques do you use to reduce database load and improve application performance?
Similar questions
- As for message brokers, you've definitely worked with Kafka. What are its components, what is it designed for, and how does it work overall?
- Have you ever designed or maintained a microservices architecture?
- How would you design fault-tolerant event processing with Kafka in a microservices architecture, given that no data can be lost?
- What technology stack have you used besides Java—message brokers (Kafka), databases, or other programming languages?
- Tell me about a Java REST API that you helped ship to production. What is one architectural decision you personally made?