|
@@ -11,6 +11,7 @@ import org.springframework.kafka.annotation.KafkaListener;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@Component
|
|
@Component
|
|
@@ -35,7 +36,12 @@ public class ProjectConsumer {
|
|
@KafkaListener(groupId = "simulation-resource-scheduler", topics = "${custom.mq-stop-project-topic}")
|
|
@KafkaListener(groupId = "simulation-resource-scheduler", topics = "${custom.mq-stop-project-topic}")
|
|
public void stopProject(ConsumerRecord<String, String> projectStopMessageRecord) {
|
|
public void stopProject(ConsumerRecord<String, String> projectStopMessageRecord) {
|
|
log.info("消费者组 simulation-resource-scheduler 接收到的项目终止消息:" + projectStopMessageRecord);
|
|
log.info("消费者组 simulation-resource-scheduler 接收到的项目终止消息:" + projectStopMessageRecord);
|
|
- projectApplicationService.stopProject(JsonUtil.jsonToBean(projectStopMessageRecord.value(), ProjectStopMessageEntity.class));
|
|
|
|
|
|
+ try {
|
|
|
|
+ TimeUnit.SECONDS.sleep(10);
|
|
|
|
+ projectApplicationService.stopProject(JsonUtil.jsonToBean(projectStopMessageRecord.value(), ProjectStopMessageEntity.class));
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|