|
@@ -288,7 +288,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
projectRunToKafka(po);
|
|
projectRunToKafka(po);
|
|
|
|
|
|
- } else {
|
|
+ } else {
|
|
if ("20".equals(param.getNowRunState())) {
|
|
if ("20".equals(param.getNowRunState())) {
|
|
|
|
|
|
param.setStartTime(new Date());
|
|
param.setStartTime(new Date());
|
|
@@ -333,7 +333,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
kafkaParameter.setData(data);
|
|
kafkaParameter.setData(data);
|
|
log.info("推送项目运行消息到kafka:" + data);
|
|
log.info("推送项目运行消息到kafka:" + data);
|
|
- kafkaService.send(kafkaParameter);
|
|
+
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:\n"
|
|
|
|
+ + "主题 topic 为:" + topic + "\n"
|
|
|
|
+ + "分区 partition 为:" + partition + "\n"
|
|
|
|
+ + "偏移量为:" + offset + "\n"
|
|
|
|
+ + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> {
|
|
|
|
+ log.error("发送消息失败:" + failure.getMessage());
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
private void projectStopToKafka(SimulationManualProjectPo po) throws JsonProcessingException {
|
|
private void projectStopToKafka(SimulationManualProjectPo po) throws JsonProcessingException {
|
|
@@ -345,7 +360,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
kafkaParameter.setData(data);
|
|
kafkaParameter.setData(data);
|
|
log.info("推送项目中止消息到kafka:" + data);
|
|
log.info("推送项目中止消息到kafka:" + data);
|
|
- kafkaService.send(kafkaParameter);
|
|
+
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:\n"
|
|
|
|
+ + "主题 topic 为:" + topic + "\n"
|
|
|
|
+ + "分区 partition 为:" + partition + "\n"
|
|
|
|
+ + "偏移量为:" + offset + "\n"
|
|
|
|
+ + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> {
|
|
|
|
+ log.error("发送消息失败:" + failure.getMessage());
|
|
|
|
+ });
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -358,7 +388,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
String data = JsonUtil.beanToJson(kafkaParam);
|
|
kafkaParameter.setData(data);
|
|
kafkaParameter.setData(data);
|
|
log.info("推送自动项目中止消息到kafka:" + data);
|
|
log.info("推送自动项目中止消息到kafka:" + data);
|
|
- kafkaService.send(kafkaParameter);
|
|
+
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:\n"
|
|
|
|
+ + "主题 topic 为:" + topic + "\n"
|
|
|
|
+ + "分区 partition 为:" + partition + "\n"
|
|
|
|
+ + "偏移量为:" + offset + "\n"
|
|
|
|
+ + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> {
|
|
|
|
+ log.error("发送消息失败:" + failure.getMessage());
|
|
|
|
+ });
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|