优化redis连接
parent
019d95cfba
commit
ebe24a6c32
|
@ -14,7 +14,8 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
|
@ -49,6 +50,9 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|||
|
||||
@Bean
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory;
|
||||
lettuceConnectionFactory.afterPropertiesSet();
|
||||
|
||||
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
||||
// 使用fastJson序列化
|
||||
FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class);
|
||||
|
@ -59,7 +63,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|||
// key的序列化采用StringRedisSerializer
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ public class Device {
|
|||
@Schema(description = "SIP交互IP(设备访问平台的IP)")
|
||||
private String localIp;
|
||||
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
|
|
@ -983,8 +983,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
return;
|
||||
}
|
||||
String addressStr = sdp.getConnection().getAddress();
|
||||
logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc,
|
||||
mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP");
|
||||
logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc,
|
||||
mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue());
|
||||
|
||||
MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem();
|
||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
|
|
Loading…
Reference in New Issue