|
|
|
@ -1,11 +1,17 @@ |
|
|
|
package com.techsor.datacenter.receiver.listener; |
|
|
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.techsor.datacenter.receiver.config.DataCenterEnvConfig; |
|
|
|
import com.techsor.datacenter.receiver.utils.DefaultHttpRequestUtil; |
|
|
|
import com.techsor.datacenter.receiver.utils.MyHTTPResponse; |
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
import jakarta.annotation.PreDestroy; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.domain.Range; |
|
|
|
import org.springframework.data.redis.connection.stream.*; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@ -23,6 +29,10 @@ public class RedisStreamConsumer { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StringRedisTemplate redisTemplate; |
|
|
|
@Resource |
|
|
|
private DefaultHttpRequestUtil defaultHttpRequestUtil; |
|
|
|
@Resource |
|
|
|
private DataCenterEnvConfig dataCenterEnvConfig; |
|
|
|
|
|
|
|
private static final int PARTITIONS = 16; |
|
|
|
private static final String STREAM_PREFIX = "aeon_tcp_stream_"; |
|
|
|
@ -232,6 +242,14 @@ public class RedisStreamConsumer { |
|
|
|
/** |
|
|
|
* ===== 业务逻辑 ===== |
|
|
|
*/ |
|
|
|
Gson gson = new Gson(); |
|
|
|
String jsonParams = gson.toJson(body); |
|
|
|
MyHTTPResponse response = this.defaultHttpRequestUtil.postJson(dataCenterEnvConfig.getF10ApiUrl(), jsonParams); |
|
|
|
if (response.getCode() == 200) { |
|
|
|
log.info("F10 data sent successfully...."); |
|
|
|
} else { |
|
|
|
log.error("F10 data sent failed...."); |
|
|
|
} |
|
|
|
|
|
|
|
success = true; |
|
|
|
} catch (Exception e) { |
|
|
|
|