ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context
It seems that you use the same jedis client for subscribe and publish. You just need to create another client and one is for subscribe and the other is for publish
It seems that you use the same jedis client for subscribe and publish. You just need to create another client and one is for subscribe and the other is for publish
There is no one answer to your question because it depends. Jedis and lettuce are both mature clients. To complete the list of Java clients, there is also Redisson, which adds another layer of abstraction (Collection/Queue/Lock/… interfaces instead of raw Redis commands). It pretty much depends on how you’re working with the clients. In general, … Read more
With Spring Data Redis 2.0, those methods have been deprecated. You now need to configure using RedisStandaloneConfiguration Reference: https://docs.spring.io/spring-data/redis/docs/current/api/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.html#setHostName-java.lang.String- Example: JedisConnectionFactory jedisConnectionFactory() { RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(“localhost”, 6379); redisStandaloneConfiguration.setPassword(RedisPassword.of(“yourRedisPasswordIfAny”)); return new JedisConnectionFactory(redisStandaloneConfiguration); }
You haven’t configured the maxTotal size of the pool, and the default value is only 8. You could change the JedisFactory constructor to: public JedisFactory() { JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(128); jedisPool = new JedisPool(poolConfig, RedisDBConfig.HOST, RedisDBConfig.PORT, RedisDBConfig.TIMEOUT, RedisDBConfig.PASSWORD); } Beware also of the default value of the WhenExhaustedAction (WHEN_EXHAUSTED_BLOCK), as it may not … Read more
I noticed that this exception can and will be thrown if Redis is not running. Just a heads up.
That question is opinion-based but lets get some objective points into it: TL; DR: The driver choice depends on multiple things: Additional dependencies Programming model Scalability Being opinionated regarding the implementation of high-level features Prospect of your project, the direction in which you want to evolve Explanation Additional dependencies Some projects are opinionated regarding additional … Read more
Ok, googled around for a while and found help at http://java.dzone.com/articles/spring-data-redis. It happened because of Java serialization. The key serializer for redisTemplate needs to be configured to StringRedisSerializer i.e. like this: <bean id=”jedisConnectionFactory” class=”org.springframework.data.redis.connection.jedis.JedisConnectionFactory” p:host-name=”${redis.server}” p:port=”${redis.port}” p:use-pool=”true”/> <bean id=”stringRedisSerializer” class=”org.springframework.data.redis.serializer.StringRedisSerializer”/> <bean id=”redisTemplate” class=”org.springframework.data.redis.core.RedisTemplate” p:connection-factory-ref=”jedisConnectionFactory” p:keySerializer-ref=”stringRedisSerializer” p:hashKeySerializer-ref=”stringRedisSerializer” /> Now the key in redis is vc:501381. Or … Read more