|
@@ -1,9 +1,13 @@
|
|
|
package com.fdkankan.constants;
|
|
|
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.log.entity.MqEcs;
|
|
|
+import com.fdkankan.log.service.IMqEcsService;
|
|
|
+import com.fdkankan.modeling.message.QueueNameService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.ApplicationContextAware;
|
|
@@ -12,6 +16,7 @@ import org.springframework.core.env.StandardEnvironment;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
@@ -72,15 +77,19 @@ public class SysConstants implements ApplicationContextAware {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IMqEcsService mqEcsService;
|
|
|
+ @Autowired
|
|
|
+ com.fdkankan.modeling.message.QueueNameService QueueNameService;
|
|
|
+
|
|
|
private void initIsResidenceService() {
|
|
|
- if(CollectionUtils.isEmpty(residenceServices) || ObjectUtils.isEmpty(SysConstants.hostName)){
|
|
|
- log.error("判断常驻服务失败!");
|
|
|
- return;
|
|
|
+ if(!StringUtils.isEmpty(SysConstants.hostName) ){
|
|
|
+ MqEcs mqEcs = mqEcsService.getByEcs(SysConstants.hostName);
|
|
|
+ if(mqEcs == null){
|
|
|
+ mqEcs = new MqEcs(QueueNameService.getQueueName(),SysConstants.hostName,0);
|
|
|
+ mqEcsService.save(mqEcs);
|
|
|
+ }
|
|
|
}
|
|
|
- log.info("常驻服务列表:{}", residenceServices);
|
|
|
- log.info("当前服务名称:{}", SysConstants.hostName);
|
|
|
- isResidenceService = residenceServices.contains(hostName);
|
|
|
- log.info("当前服务是否是常驻服务:{}", isResidenceService);
|
|
|
}
|
|
|
|
|
|
@Override
|