Browse Source

场景批量下载

dsx 1 year ago
parent
commit
338ffd0b51

+ 34 - 0
src/main/java/com/fdkankan/download/listener/RsyncSceneListener.java

@@ -0,0 +1,34 @@
+package com.fdkankan.download.listener;
+
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Component
+public class RsyncSceneListener {
+
+    /**
+     * 场景计算状态日志记录
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+//    @RabbitListener(
+//            queuesToDeclare = @Queue("rsync-scene"),
+//            concurrency = "2"
+//    )
+//    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+//        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+//        System.out.println(msg);
+//        Thread.sleep(60000L);
+//        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+//    }
+
+}

+ 1 - 1
src/main/java/com/fdkankan/download/service/impl/DownloadServiceImpl.java

@@ -204,7 +204,7 @@ public class DownloadServiceImpl implements IDownloadService {
     private void zipOssFiles(String num, String resolution, int imagesVersion, Set<String> cacheKeys, String version) throws Exception{
 
 //        fYunFileService.downloadFileByCommand(String.format(sourceLocal, num, this.wwwroot), String.format(UploadFilePath.VIEW_PATH, num));
-        final List<String> strings = fYunFileService.listRemoteFiles(String.format(UploadFilePath.VIEW_PATH, num));
+        List<String> strings = fYunFileService.listRemoteFiles(String.format(UploadFilePath.VIEW_PATH, num));
         strings.stream().forEach(str->{
             fYunFileService.downloadFile(str, String.format(sourceLocal, num, this.wwwroot).concat(str));
         });

+ 1 - 1
src/main/resources/application-dev.yml

@@ -25,7 +25,7 @@ spring:
     connection-timeout: 0
     listener:
       simple:
-        prefetch: 5
+        prefetch: 2
         max-concurrency: 10
         acknowledge-mode: manual #开启消费者手动确认
     #开启消息投递确认机制