|
@@ -1,5 +1,7 @@
|
|
|
package com.fdkankan.download.listener;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.util.CmdUtils;
|
|
|
import com.fdkankan.download.constant.CommonConstant;
|
|
|
import com.rabbitmq.client.Channel;
|
|
@@ -41,8 +43,10 @@ public class RsyncSceneListener {
|
|
|
concurrency = "2"
|
|
|
)
|
|
|
public void buildScenePreHandler(Channel channel, Message message) throws Exception {
|
|
|
- String path = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
- System.out.println(path);
|
|
|
+ String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
+ JSONObject jsonObject = JSON.parseObject(msg);
|
|
|
+ String path = jsonObject.getString("path");
|
|
|
+ System.out.println(msg);
|
|
|
String cmd = RSYNC_CMD.replace("$port", port).replace("$source", path).replace("$user", username).replace("$host", host).replace("$dest", dest);
|
|
|
CmdUtils.callLine(cmd);
|
|
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|