Browse Source

队列模块BUG处理

guq 7 years ago
parent
commit
0c2cfba18a

+ 6 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/docker/Dockerfile

@@ -0,0 +1,6 @@
+FROM frolvlad/alpine-oraclejdk8:slim
+VOLUME /tmp
+ADD transfers-server-1.0.0-SNAPSHOT.jar app.jar
+RUN sh -c 'touch /app.jar'
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

+ 0 - 24
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/po/MessageInfo.java

@@ -28,14 +28,6 @@ public class MessageInfo implements Serializable {
      * 业务单据ID
      */
     private String bizId;
-    /**
-     * 时间戳
-     */
-    private long timestamp;
-    /**
-     * 重试次数
-     */
-    private int retryCount;
 
     public String getMsgId() {
         return msgId;
@@ -77,22 +69,6 @@ public class MessageInfo implements Serializable {
         this.bizId = bizId;
     }
 
-    public long getTimestamp() {
-        return timestamp;
-    }
-
-    public void setTimestamp(long timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    public int getRetryCount() {
-        return retryCount;
-    }
-
-    public void setRetryCount(int retryCount) {
-        this.retryCount = retryCount;
-    }
-
     public MessageInfo(String userId, String appId, String bizType, String bizId) {
         this.userId = userId;
         this.appId = appId;

+ 2 - 2
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/service/BaseRabbitReceiveService.java

@@ -188,7 +188,7 @@ public abstract class BaseRabbitReceiveService implements ChannelAwareMessageLis
      */
     private void sendDelayMessage(MessageInfo messageInfo, Channel channel, String queueName) {
         //重试次数+1
-        messageInfo.setRetryCount(messageInfo.getRetryCount() + 1);
+        /*messageInfo.setRetryCount(messageInfo.getRetryCount() + 1);
         String messageJson = JsonUtils.toJsonString(messageInfo);
         try {
             String dQueueName = getDelayQueueName(channel, queueName);
@@ -199,7 +199,7 @@ public abstract class BaseRabbitReceiveService implements ChannelAwareMessageLis
             LOGGER.info("发送延时消息[BaseRabbitReceiveService.sendDelayMessage].正常,messageJson:{},queueName:{}", messageJson, queueName);
         } catch (IOException e) {
             LOGGER.error("发送延时消息[BaseRabbitReceiveService.sendDelayMessage].异常,messageJson:{},queueName:{}", messageJson, queueName, e);
-        }
+        }*/
     }
 
     /**

+ 30 - 0
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/TaskSchedulerConfig.java

@@ -0,0 +1,30 @@
+package com.usoftchina.saas.transfers.task;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+/**
+ * @author: guq
+ * @create: 2018-12-29 09:38
+ **/
+@Configuration
+@EnableScheduling
+public class TaskSchedulerConfig implements SchedulingConfigurer{
+
+    @Override
+    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
+        scheduledTaskRegistrar.setScheduler(taskScheduler());
+    }
+
+    @Bean(destroyMethod = "shutdown")
+    public Executor taskScheduler() {
+        return Executors.newScheduledThreadPool(100);
+    }
+
+}