-
Notifications
You must be signed in to change notification settings - Fork 162
10. StockService Microservice Create Kafka Consumer.md
Ramesh Fadatare edited this page Jul 11, 2022
·
1 revision
package net.javaguides.stockservice.kafka;
import net.javaguides.basedomains.dto.OrderEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
@Service
public class OrderConsumer {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderConsumer.class);
@KafkaListener(
topics = "${spring.kafka.topic.name}",
groupId = "${spring.kafka.consumer.group-id}"
)
public void consume(OrderEvent orderEvent){
LOGGER.info(String.format("Event message received in stock service-> %s", orderEvent.toString()));
}
}