|
@@ -0,0 +1,37 @@
|
|
|
+package com.fdkankan.modeling.receiver;
|
|
|
+
|
|
|
+import com.fdkankan.modeling.constants.SysConstants;
|
|
|
+import com.fdkankan.modeling.entity.MqEcs;
|
|
|
+import com.fdkankan.modeling.service.IMqEcsService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class QueueNameService {
|
|
|
+
|
|
|
+ @Value("${queue.modeling.modeling-call}")
|
|
|
+ private String queue;
|
|
|
+ @Autowired
|
|
|
+ IMqEcsService mqEcsService;
|
|
|
+
|
|
|
+
|
|
|
+ public String getQueueName(){
|
|
|
+ String queueName = queue;
|
|
|
+ if(StringUtils.isBlank(SysConstants.hostName)){
|
|
|
+ log.info("获取hostName失败,监听队列名为:{}",queueName);
|
|
|
+ return queueName;
|
|
|
+ }
|
|
|
+ MqEcs mqEcs = mqEcsService.getByHostName(SysConstants.hostName);
|
|
|
+ if(mqEcs != null ){
|
|
|
+ queueName = mqEcs.getQueueName();
|
|
|
+ log.info("获取hostNam成功,监听队列名为:{}",queueName);
|
|
|
+ return queueName;
|
|
|
+ }
|
|
|
+ log.info("获取hostName失败,监听队列名为:{}",queueName);
|
|
|
+ return queueName;
|
|
|
+ }
|
|
|
+}
|