spring-guides / gs-messaging-redis Goto Github PK
View Code? Open in Web Editor NEWMessaging with Redis :: Learn how to use Redis as a message broker.
Home Page: http://spring.io/guides/gs/messaging-redis/
License: Apache License 2.0
Messaging with Redis :: Learn how to use Redis as a message broker.
Home Page: http://spring.io/guides/gs/messaging-redis/
License: Apache License 2.0
The guide says Download the resulting ZIP file, which is an archive of a web application that is configured with your choices.
but this is not a web application.
Does spring boot provide something like @JmsListener
,@RabbitListener
to support redis when use as messaging
As the discussion in #20 indicates, it would be good to add a link to the Spring Boot docs that have to do with Redis configuration.
This is a good one for a first-time committer.
Update the guide to use the most recent Spring Boot version.
Files that require changes are:
initial/build.gradle
initial/pom.xml
complete/build.gradle
complete/pom.xml
I use this example in our project. However, some problems occurred during usage, CPU consumption suddenly increased to 100%, memory consumption suddenly increased. It is found that the thread created by RedisMessageListenerContainer has been increasing and has not been released. This is very deadly. I want to know if I'm writing something wrong, or if I have a way to avoid it and optimize it.
`
@configuration
public class SubscriberConfig {
/**
* 创建连接工厂
* @param connectionFactory
* @param listenerAdapter
* @return
*/
@bean
public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
MessageListenerAdapter realDataListener){
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(realDataListener,new PatternTopic(RedisTopicUtil.TOPIC_REAL_DATA));
return container;
}
/**
* 绑定消息监听者和接收监听的方法
* @param receiver
* @return
*/
@Bean
public MessageListenerAdapter realDataListener(RedisTopicReceiver redisTopicReceiver){
return new MessageListenerAdapter(redisTopicReceiver,"realDataListener");
}
/**
* 注册订阅者
* @param latch
* @return
*/
@Bean
public RedisTopicReceiver redisTopicReceiver(){
return new RedisTopicReceiver();
}
}
public class RedisTopicReceiver {
private static final Logger LOGGER = LoggerFactory.getLogger(RedisTopicReceiver.class);
@Autowired
public RedisTopicReceiver() {
}
/**
*
* <p>Title: realDataListener</p>
* <p>Description:读取接收到的实时数据 </p>
* @param message
*/
public void realDataListener(String message) {
LOGGER.info("Received realDataListener :<" + message + ">");
}
}
`
I am not familiar with spring framework. I tried to use setHostname/setPort
or RedisStandaloneConfiguration
to configure host/port, but it always reported error ...
I think as guide for spring, it will be beneficial adding example on configuring host/port instead of using the default config. Thanks
When I run the code as is, it never exits main, because the latch.await() is never satisfied. Using redis-cli monitor command, I see that the publish occurs before the subscription.
1581214604.709415 [0 127.0.0.1:61178] "PUBLISH" "chat" "Hello from Redis!" 1581214604.733783 [0 127.0.0.1:61179] "PSUBSCRIBE" "chat"
I confirmed that the container is alive and running before the send. I did not try to find a way to be notified when the subscribe is actually made. A sleep before the send was enough to change the behavior on my machine, but that's certainly not a true fix.
Some info about my setup:
MBP A1398 running OS X 10.12.6
Java 1.8.0_131
Spring Boot 2.2.4
Eclipse 2019-12 (I am running the app via Run As...)
Redis 3.2.0 (installed with brew)
Hi, I am new to Spring Data Redis. Actually, I am working on a Spring boot application, where my requirement is something like the following:
On update of certain DB tables through an API, I would like to publish and "REFRESH" event to REDIS. I have 3 pods in the AWS EKS cluster and in each of the POD, my Spring Boot application is running. So, I would like each of these PODs will receive the event and refresh beans associated with the table.
I have been able to achieve this by running a scheduler at a fixed rate inside the application instance running on each POD, which is working fine.
But I would like to do this in an event-triggered way. So in this context, I found Spring Data Redis. But I am not sure, it would suffice my purpose.
Could anyone please help here with some pointers? Thanks.
The gs-messaging-redis guide has missing dependencies.
java.lang.ClassNotFoundException: redis.clients.util.Pool
When I add the missing dependency
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.4.1</version>
</dependency>
I get another dependency error, that I did not investigate further:
java.lang.ClassNotFoundException: org.apache.commons.pool.impl.GenericObjectPool$Config
The guide is currently not fully making use of @EnableAutoconfiguration
as the boot config is checking for lettuce
. Once boot switches to jedis
the then obsolete configuration in Application can be removed.
This is just some kind of marker issue to ensure its done once boot 1.1. is out.
can you please share how to use the connection information for Redis from application.properties file
With the Redis license changes, this statement is no longer accurate Redis is an open source, BSD-licensed, key-value data store that also comes with a messaging system.
I think we should just be able to remove this sentence.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.