|
|
@@ -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;
|
|
|
|
|
|
@@ -41,6 +45,9 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|
|
@Value("${spring.redis.poolMaxWait:5}")
|
|
|
private int poolMaxWait;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisGPSMsgListener redisGPSMsgListener;
|
|
|
+
|
|
|
@Bean
|
|
|
public JedisPool jedisPool() {
|
|
|
if (StringUtils.isBlank(password)) {
|
|
|
@@ -85,6 +92,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|
|
|
|
|
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
|
|
container.setConnectionFactory(connectionFactory);
|
|
|
+ container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_GPS_PREFIX));
|
|
|
return container;
|
|
|
}
|
|
|
|