Example usage for org.springframework.data.redis.listener PatternTopic PatternTopic

List of usage examples for org.springframework.data.redis.listener PatternTopic PatternTopic

Introduction

In this page you can find the example usage for org.springframework.data.redis.listener PatternTopic PatternTopic.

Prototype

public PatternTopic(String pattern) 

Source Link

Document

Constructs a new PatternTopic instance.

Usage

From source file:eu.supersede.fe.listener.Listeners.java

@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
    RedisMessageListenerContainer container = new RedisMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);

    MessageListenerAdapter profileAdapter = new MessageListenerAdapter(profileListener, "receiveMessage");
    profileAdapter.afterPropertiesSet();
    container.addMessageListener(profileAdapter, new PatternTopic("profile"));

    MessageListenerAdapter notificationAdapter = new MessageListenerAdapter(notificationListener,
            "receiveMessage");
    notificationAdapter.afterPropertiesSet();
    container.addMessageListener(notificationAdapter, new PatternTopic("notification"));

    return container;
}

From source file:com.greglturnquist.springagram.frontend.BackendTrafficListener.java

@Bean
RedisMessageListenerContainer container(RedisConnectionFactory factory, MessageListener messageListener) {

    RedisMessageListenerContainer container = new RedisMessageListenerContainer();
    container.setConnectionFactory(factory);
    container.addMessageListener(messageListener, new PatternTopic("/topic/*"));
    return container;
}

From source file:org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration.java

@Bean
public RedisMessageListenerContainer springSessionRedisMessageListenerContainer(
        RedisOperationsSessionRepository sessionRepository) {
    RedisMessageListenerContainer container = new RedisMessageListenerContainer();
    container.setConnectionFactory(this.redisConnectionFactory);
    if (this.redisTaskExecutor != null) {
        container.setTaskExecutor(this.redisTaskExecutor);
    }// w  ww. j a va 2  s  . c o m
    if (this.redisSubscriptionExecutor != null) {
        container.setSubscriptionExecutor(this.redisSubscriptionExecutor);
    }
    container.addMessageListener(sessionRepository,
            Arrays.asList(new ChannelTopic(sessionRepository.getSessionDeletedChannel()),
                    new ChannelTopic(sessionRepository.getSessionExpiredChannel())));
    container.addMessageListener(sessionRepository, Collections
            .singletonList(new PatternTopic(sessionRepository.getSessionCreatedChannelPrefix() + "*")));
    return container;
}