|
|
@ -13,6 +13,7 @@ import org.springframework.data.domain.Range; |
|
|
import org.springframework.data.redis.connection.stream.*; |
|
|
import org.springframework.data.redis.connection.stream.*; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
|
|
|
import org.springframework.scheduling.concurrent.CustomizableThreadFactory; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
import java.net.InetAddress; |
|
|
import java.net.InetAddress; |
|
|
@ -34,6 +35,8 @@ public class RedisStreamConsumer { |
|
|
@Resource |
|
|
@Resource |
|
|
private DataCenterEnvConfig dataCenterEnvConfig; |
|
|
private DataCenterEnvConfig dataCenterEnvConfig; |
|
|
|
|
|
|
|
|
|
|
|
private static final Gson gson = new Gson(); |
|
|
|
|
|
|
|
|
private static final int PARTITIONS = 16; |
|
|
private static final int PARTITIONS = 16; |
|
|
private static final String STREAM_PREFIX = "aeon_tcp_stream_"; |
|
|
private static final String STREAM_PREFIX = "aeon_tcp_stream_"; |
|
|
private static final String GROUP = "aeon_tcp_stream_consumer_group"; |
|
|
private static final String GROUP = "aeon_tcp_stream_consumer_group"; |
|
|
@ -56,7 +59,7 @@ public class RedisStreamConsumer { |
|
|
private final LongAdder receiveCounter = new LongAdder(); |
|
|
private final LongAdder receiveCounter = new LongAdder(); |
|
|
|
|
|
|
|
|
private final ExecutorService consumerExecutor = |
|
|
private final ExecutorService consumerExecutor = |
|
|
Executors.newFixedThreadPool(PARTITIONS); |
|
|
Executors.newFixedThreadPool(PARTITIONS, new CustomizableThreadFactory("redis-stream-consumer-")); |
|
|
|
|
|
|
|
|
private final ExecutorService workerExecutor = |
|
|
private final ExecutorService workerExecutor = |
|
|
new ThreadPoolExecutor( |
|
|
new ThreadPoolExecutor( |
|
|
@ -242,10 +245,9 @@ public class RedisStreamConsumer { |
|
|
/** |
|
|
/** |
|
|
* ===== 业务逻辑 ===== |
|
|
* ===== 业务逻辑 ===== |
|
|
*/ |
|
|
*/ |
|
|
Gson gson = new Gson(); |
|
|
|
|
|
String jsonParams = gson.toJson(body); |
|
|
String jsonParams = gson.toJson(body); |
|
|
MyHTTPResponse response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getF10ApiUrl(), jsonParams); |
|
|
MyHTTPResponse response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getF10ApiUrl(), jsonParams); |
|
|
if (response.getCode() == 200) { |
|
|
if (response != null && response.getCode() == 200) { |
|
|
log.info("[F10] F10 data sent successfully: {}", jsonParams); |
|
|
log.info("[F10] F10 data sent successfully: {}", jsonParams); |
|
|
} else { |
|
|
} else { |
|
|
log.error("[F10] F10 data sent failed...."); |
|
|
log.error("[F10] F10 data sent failed...."); |
|
|
|