Files
msgexchange-api/src/main/java/com/gzzn/omms/msgexchangeapi/controller/KafkaController.java
T

29 lines
880 B
Java
Raw Normal View History

2018-11-23 09:08:15 +08:00
package com.gzzn.omms.msgexchangeapi.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gzzn.omms.msgexchangeapi.dto.ResponseDto;
import com.gzzn.omms.msgexchangeapi.service.IKafkaService;
@RestController
@RequestMapping("/kafka")
public class KafkaController {
@Autowired
private IKafkaService kafkaservice;
2018-11-28 16:51:42 +08:00
/**
* 发送消息到kafka指定topic上
* @param msg
* @param topic
* @return
*/
2018-11-23 09:08:15 +08:00
@GetMapping(value = "/send")
public ResponseDto sendKafka(String msg,String topic) {
kafkaservice.msgSend(topic, msg);
return ResponseDto.success();
}
}