spring-projects / spring-projects/spring-data-redis

keyspaceEvents cannot be configured [DATAREDIS-1075]

Open
#1,612 2 comments 0 reactions 1 assignee View on GitHub

@christophstrobl is already working on this.

Since Dec 30, 2020.

in: cache in: jedis in: repository type: bug
Dominant language
Java
Stars
1.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

ismael COULIBALY opened DATAREDIS-1075 and commented

Hey guys,
Me and my team are facing a probleme due to the usage of Spring Data Redis 2.2.2 in a Spring Boot App.
We are working on a App based on a microservice architecture. Three of our microservices put data in the same instance of Redis but inside different logical databases.
Some of data we put into Redis are tagged with the annotation @TimeToLive (TTL).
We also enabled the keyspaceEvents on start up [@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)].

The probleme we face is that keyspaceEvents are seen (received) by all logical databases. That make our pool of connection explode.

It seems like the management of keyspaceEvents is done right here : https://github.com/spring-projects/spring-data-redis/blob/master/src/main/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListener.java
In the code, we can see this : "keyevent@*:expired".
The wildcard means that the keyspaceEvents are seen by every logical database.

So, all of our microservices pollute each other because each of them see the keyspaceEvents of the other.

Can you make keyspaceEvents management configurable (TTL in particular) so that a logical database only receive events that happen in his scope ?

Regards


Referenced from: pull request https://github.com/spring-projects/spring-data-redis/pull/503

1 votes, 2 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.