-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default value for KeyspaceEventMessageListener
on keyspace event notifications
#2670
Labels
Comments
jxblum
changed the title
Change default value for KeyExpirationEventMessageListener to disable notifications
Change default value for Aug 10, 2023
KeyExpirationEventMessageListener
to disable notifications
jxblum
changed the title
Change default value for
Change default value for Aug 10, 2023
KeyExpirationEventMessageListener
to disable notificationsKeyExpirationEventMessageListener
keyspace event notifications
jxblum
changed the title
Change default value for
Change default value for Aug 10, 2023
KeyExpirationEventMessageListener
keyspace event notificationsKeyspaceEventMessageListener
keyspace event notifications
jxblum
added a commit
to jxblum/spring-data-redis
that referenced
this issue
Aug 10, 2023
…notifications. Users must now explicitly call setKeyspaceNotificationsConfigParameter(:String) to a valid redis.config, notify-keyspace-events value to enable Redis keyspace notifications. This aligns with the Redis servers default setting for notify-keyspace-events in redis.conf, which is disabled by default. Additionally, the default value for KeyExpirationEventMessageListener has been changed to 'Ex', for development-time convenience only. However, users should be aware that any notify-keyspace-events configuration only applies once on Spring container initialization and any Redis server reboot will not remember dynamic configuration modifications applied at runtime. Therefore, it is recommended that users applly infrastructure-related configuration changes directly to redis.conf. Closes spring-projects#2670
This was referenced Aug 10, 2023
jxblum
added a commit
to jxblum/spring-data-redis
that referenced
this issue
Aug 11, 2023
…notifications. Users must now explicitly call setKeyspaceNotificationsConfigParameter(:String) to a valid redis.config, notify-keyspace-events value to enable Redis keyspace notifications. This aligns with the Redis servers default setting for notify-keyspace-events in redis.conf, which is disabled by default. Additionally, the default value for KeyExpirationEventMessageListener has been changed to 'Ex', for development-time convenience only. However, users should be aware that any notify-keyspace-events configuration only applies once on Spring container initialization and any Redis server reboot will not remember dynamic configuration modifications applied at runtime. Therefore, it is recommended that users applly infrastructure-related configuration changes directly to redis.conf. Closes spring-projects#2670
jxblum
changed the title
Change default value for
Change default value for Aug 15, 2023
KeyspaceEventMessageListener
keyspace event notificationsKeyspaceEventMessageListener
on keyspace event notifications
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The default value in Spring Data Redis for
notify-keyspace-events
is set toEA
. Therefore, when a user declares and registers a bean of typeKeyExpirationEventMessageListener
(which extendsKeyspaceEventMessageListener
) in the SpringApplicationContext
, Spring Data Redis will send aconfig set notify-keyspace-events EA
command to the Redis server on initialization (and then init()).While this may be "convenient" during development, it is NOT (ever) appropriate for production deployments, and can lead to confusing behavior exactly like this.
With a combination of Lettuce attempting to reconnect (Jedis will not automatically reconnect) and the fact that Redis does not retain configuration changes between restarts (i.e. non-persistent config when changed at runtime; even when applied using the
redis-cli
), then this situation, such as in Issue #2654, can occur.Therefore, it is recommend the default value in Spring Data Redis be changed to empty, precisely how the Redis server (in
redis.conf
from a clean install) defines this setting, itself.If users change the default (e.g. to
EA
, or otherwise), then they have chosen to "opt-in" and are therefore responsible for the change, such as when the Redis server needs to be restarted.As explained in Issue #2654, the appropriate location to declare "infrastructure-related" configuration settings to the Redis server is in the
redis.conf
file, where it belongs! Additionally, users must ensure any custom (modified) configuration file is then passed to and recognized by the Redis server on start.In conclusion, the framework, or any library for that matter, should never be making "infrastructure" decisions for users.
The text was updated successfully, but these errors were encountered: