Junior — Middle
Did you have experience working with Kafka in your last project?
sobes.tech AI
Answer from AI
Yes, in my last project I worked with Apache Kafka to facilitate message exchange between microservices. I used Kafka for real-time event transmission, which ensured high performance and reliability.
The main tasks I handled included:
- Setting up producers and consumers in Java using Kafka Client API.
- Processing messages with guaranteed order and delivery.
- Working with topics and partitions for scaling.
- Monitoring broker status and managing consumption.
Here's an example of a simple producer in Java:
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
KafkaProducer<String, String> producer = new KafkaProducer<>(props);
producer.send(new ProducerRecord<>("my-topic", "key1", "value1"));
producer.close();
This experience helped me understand how to effectively build high-load asynchronous systems.