package com.example.kafka.consumer;

import com.example.kafka.service.OrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;


/**
 * Message consumer class :: to consume messages from kafka topics
 */
@Component
public class MessageConsumer {

    @Autowired
    private OrderServiceImpl orderService;

    /**
     * read message method define to consume messages from kafka
     * @param order the message
     */
    @KafkaListener(topics = "${app.topic.name}",groupId = "group1")
    public void readMessage(String order){
        orderService.validateOrder(order);
    }   

}
