Commit ebe24a6c32c7337613176e718d9e818f7fa649c7
1 parent
019d95cf
优化redis连接
Showing
4 changed files
with
9 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java
| @@ -14,7 +14,8 @@ import org.springframework.stereotype.Component; | @@ -14,7 +14,8 @@ import org.springframework.stereotype.Component; | ||
| 14 | import org.springframework.util.ObjectUtils; | 14 | import org.springframework.util.ObjectUtils; |
| 15 | import org.springframework.web.filter.OncePerRequestFilter; | 15 | import org.springframework.web.filter.OncePerRequestFilter; |
| 16 | 16 | ||
| 17 | -import javax.servlet.*; | 17 | +import javax.servlet.FilterChain; |
| 18 | +import javax.servlet.ServletException; | ||
| 18 | import javax.servlet.annotation.WebFilter; | 19 | import javax.servlet.annotation.WebFilter; |
| 19 | import javax.servlet.http.HttpServletRequest; | 20 | import javax.servlet.http.HttpServletRequest; |
| 20 | import javax.servlet.http.HttpServletResponse; | 21 | import javax.servlet.http.HttpServletResponse; |
src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java
| @@ -10,6 +10,7 @@ import org.springframework.context.annotation.Bean; | @@ -10,6 +10,7 @@ import org.springframework.context.annotation.Bean; | ||
| 10 | import org.springframework.context.annotation.Configuration; | 10 | import org.springframework.context.annotation.Configuration; |
| 11 | import org.springframework.core.annotation.Order; | 11 | import org.springframework.core.annotation.Order; |
| 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; | 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 13 | +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
| 13 | import org.springframework.data.redis.core.RedisTemplate; | 14 | import org.springframework.data.redis.core.RedisTemplate; |
| 14 | import org.springframework.data.redis.listener.PatternTopic; | 15 | import org.springframework.data.redis.listener.PatternTopic; |
| 15 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 16 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| @@ -49,6 +50,9 @@ public class RedisConfig extends CachingConfigurerSupport { | @@ -49,6 +50,9 @@ public class RedisConfig extends CachingConfigurerSupport { | ||
| 49 | 50 | ||
| 50 | @Bean | 51 | @Bean |
| 51 | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | 52 | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { |
| 53 | + LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory; | ||
| 54 | + lettuceConnectionFactory.afterPropertiesSet(); | ||
| 55 | + | ||
| 52 | RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); | 56 | RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); |
| 53 | // 使用fastJson序列化 | 57 | // 使用fastJson序列化 |
| 54 | FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); | 58 | FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); |
| @@ -59,7 +63,7 @@ public class RedisConfig extends CachingConfigurerSupport { | @@ -59,7 +63,7 @@ public class RedisConfig extends CachingConfigurerSupport { | ||
| 59 | // key的序列化采用StringRedisSerializer | 63 | // key的序列化采用StringRedisSerializer |
| 60 | redisTemplate.setKeySerializer(new StringRedisSerializer()); | 64 | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| 61 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); | 65 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| 62 | - redisTemplate.setConnectionFactory(redisConnectionFactory); | 66 | + redisTemplate.setConnectionFactory(lettuceConnectionFactory); |
| 63 | return redisTemplate; | 67 | return redisTemplate; |
| 64 | } | 68 | } |
| 65 | 69 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -188,7 +188,6 @@ public class Device { | @@ -188,7 +188,6 @@ public class Device { | ||
| 188 | @Schema(description = "SIP交互IP(设备访问平台的IP)") | 188 | @Schema(description = "SIP交互IP(设备访问平台的IP)") |
| 189 | private String localIp; | 189 | private String localIp; |
| 190 | 190 | ||
| 191 | - | ||
| 192 | public String getDeviceId() { | 191 | public String getDeviceId() { |
| 193 | return deviceId; | 192 | return deviceId; |
| 194 | } | 193 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| @@ -983,8 +983,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -983,8 +983,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 983 | return; | 983 | return; |
| 984 | } | 984 | } |
| 985 | String addressStr = sdp.getConnection().getAddress(); | 985 | String addressStr = sdp.getConnection().getAddress(); |
| 986 | - logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc, | ||
| 987 | - mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP"); | 986 | + logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc, |
| 987 | + mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue()); | ||
| 988 | 988 | ||
| 989 | MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); | 989 | MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); |
| 990 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | 990 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |