|
@@ -6,6 +6,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.core.AmqpTemplate;
|
|
import org.springframework.amqp.core.AmqpTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
+import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
|
+import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author xucaiqin
|
|
* @author xucaiqin
|
|
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Component;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class HttpService {
|
|
public class HttpService {
|
|
|
private final AmqpTemplate amqpTemplate;
|
|
private final AmqpTemplate amqpTemplate;
|
|
|
|
|
+ private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(4, 4, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1500));
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 数据上报
|
|
* 数据上报
|
|
@@ -25,6 +29,6 @@ public class HttpService {
|
|
|
* @param data
|
|
* @param data
|
|
|
*/
|
|
*/
|
|
|
public void dataReport(String code, String deviceSn, Object data) {
|
|
public void dataReport(String code, String deviceSn, Object data) {
|
|
|
- amqpTemplate.convertAndSend(QueueEnum.RAW_QUEUE.getName(), new RawData(code, deviceSn, data, 2));
|
|
|
|
|
|
|
+ threadPoolExecutor.execute(() -> amqpTemplate.convertAndSend(QueueEnum.RAW_QUEUE, new RawData(code, deviceSn, data, 2)));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|