1、请求接口数据的接受Controller类对象进行接收处理
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;/*** @author: 主要是测试数据发送kafka数据* @date: 2020-08-06 20:20:00* @description 直接发送JSON发送到kafka的指定队列里面*/@RestController
@RequestMapping(value = "/kafka")
public class KafkaController {@AutowiredKafkaTemplate kafkaTemplate;private static final String NEWS_INFO_TOPIC = "bus_to_platform";private static final String COLLECTION_TO_BUS = "collec_to_bus";@RequestMapping(value = "/newsInfo/test", method = RequestMethod.POST)public void testNewsInfo(@RequestBody JSONObject params) {kafkaTe