Created
December 5, 2017 15:03
-
-
Save odedia/9b4a203367ffc7626f652b3303b23098 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Configuration | |
| @EnableScheduling | |
| public class RedisHttpSessionConfiguration extends SpringHttpSessionConfiguration | |
| implements EmbeddedValueResolverAware, ImportAware { | |
| @Bean | |
| public RedisMessageListenerContainer redisMessageListenerContainer( | |
| RedisConnectionFactory connectionFactory, | |
| RedisOperationsSessionRepository messageListener) { | |
| RedisMessageListenerContainer container = new RedisMessageListenerContainer(); | |
| container.setConnectionFactory(connectionFactory); | |
| if (this.redisTaskExecutor != null) { | |
| container.setTaskExecutor(this.redisTaskExecutor); | |
| } | |
| if (this.redisSubscriptionExecutor != null) { | |
| container.setSubscriptionExecutor(this.redisSubscriptionExecutor); | |
| } | |
| container.addMessageListener(messageListener, | |
| Arrays.asList(new PatternTopic("__keyevent@*:del"), | |
| new PatternTopic("__keyevent@*:expired"))); | |
| container.addMessageListener(messageListener, Arrays.asList(new PatternTopic( | |
| messageListener.getSessionCreatedChannelPrefix() + "*"))); | |
| return container; | |
| } | |
| /** | |
| * Sets the action to perform for configuring Redis. | |
| * | |
| * @param configureRedisAction the configureRedis to set. The default is | |
| * {@link ConfigureNotifyKeyspaceEventsAction}. | |
| */ | |
| @Autowired(required = false) | |
| public void setConfigureRedisAction(ConfigureRedisAction configureRedisAction) { | |
| this.configureRedisAction = configureRedisAction; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment