Junior — Middle
What experience do you have with messaging systems and queue brokers?
sobes.tech AI
Answer from AI
In my practice, I have worked with message brokers such as RabbitMQ and Apache Kafka. I used them to organize asynchronous data exchange between microservices and for event processing.
For example, with RabbitMQ in Java, you can send a message like this:
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
try (Connection connection = factory.newConnection();
Channel channel = connection.createChannel()) {
channel.queueDeclare("task_queue", true, false, false, null);
String message = "Hello World!";
channel.basicPublish("", "task_queue",
MessageProperties.PERSISTENT_TEXT_PLAIN,
message.getBytes("UTF-8"));
System.out.println(" [x] Sent '" + message + "'");
}
This approach helps unload the main services and increase the system's scalability.