648540858
2022-01-25 1dbb559b388831b5f15e690d0b33d24b1faaa983
src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
@@ -1,12 +1,16 @@
package com.genersoft.iot.vmp.conf;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.service.impl.RedisGPSMsgListener;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@@ -40,6 +44,9 @@
   private int poolMaxIdle;
   @Value("${spring.redis.poolMaxWait:5}")
   private int poolMaxWait;
   @Autowired
   private RedisGPSMsgListener redisGPSMsgListener;
   @Bean
   public JedisPool jedisPool() {
@@ -85,6 +92,7 @@
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        container.setConnectionFactory(connectionFactory);
      container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_GPS_PREFIX));
        return container;
    }