From 458e7d18b77f0f47be2969491b42de9b6d8b27f0 Mon Sep 17 00:00:00 2001 From: lin <18010473990@163.com> Date: 星期五, 07 一月 2022 19:37:05 +0800 Subject: [PATCH] 添加接收redis订阅的GPS消息,为GPS订阅发送到级联平台做准备 --- src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java index dcb0e81..5f04a08 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java +++ b/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; } -- Gitblit v1.8.0