本文整理汇总了Java中org.springframework.data.redis.listener.RedisMessageListenerContainer类的典型用法代码示例。如果您正苦于以下问题:Java RedisMessageListenerContainer类的具体用法?Java RedisMessageListenerContainer怎么用?Java RedisMessageListenerContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RedisMessageListenerContainer类属于org.springframework.data.redis.listener包,在下文中一共展示了RedisMessageListenerContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: redisMessageListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer() {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(this.redisConnectionFactory);
if (this.redisTaskExecutor != null) {
container.setTaskExecutor(this.redisTaskExecutor);
}
if (this.redisSubscriptionExecutor != null) {
container.setSubscriptionExecutor(this.redisSubscriptionExecutor);
}
container.addMessageListener(sessionRepository(),
Arrays.asList(new PatternTopic("[email protected]*:del"),
new PatternTopic("[email protected]*:expired")));
container.addMessageListener(sessionRepository(),
Collections.singletonList(new PatternTopic(
sessionRepository().getSessionCreatedChannelPrefix() + "*")));
return container;
}
示例2: redisMessageListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
RedisMessageListenerContainer redisMessageListenerContainer() {
final RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory( getConnectionFactory() );
container.addMessageListener( messageListenerAdapter(), createTopic() );
return container;
}
示例3: redisContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
RedisMessageListenerContainer redisContainer() {
RedisMessageListenerContainer container
= new RedisMessageListenerContainer();
container.setConnectionFactory(jedisConnFactory());
container.addMessageListener(messageListener(), topic());
return container;
}
示例4: redisContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
RedisMessageListenerContainer redisContainer() {
final RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(jedisConnectionFactory());
container.addMessageListener(messageListener(), topic());
return container;
}
示例5: redisMessageListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer(
RedisConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(listenerAdapter, new PatternTopic("__key*__:*"));
return container;
}
示例6: setUp
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
RedisConnectionFactory connectionFactory = TestRedis.connectionFactory();
WorkerDaoImpl workerDao = new WorkerDaoImpl();
workerDao.setConnectionFactory(connectionFactory);
workerDao.setNamespace("test");
workerDao.afterPropertiesSet();
RedisMessageListenerContainer listenerContainer = new RedisMessageListenerContainer();
listenerContainer.setConnectionFactory(connectionFactory);
listenerContainer.afterPropertiesSet();
listenerContainer.start();
ChannelDaoImpl channelDao = new ChannelDaoImpl();
channelDao.setConnectionFactory(connectionFactory);
channelDao.setNamespace("test");
channelDao.setExecutions(new TestExecutionRedisSerializer(TestJob.class));
channelDao.afterPropertiesSet();
ChannelWorkerFactoryBean factory = new ChannelWorkerFactoryBean();
factory.setWorkerDao(workerDao);
factory.setChannelDao(channelDao);
factory.setChannels("test-channel");
factory.setListenerContainer(listenerContainer);
factory.setApplicationEventPublisher(eventBus);
factory.setJobRunnerFactory(new TestJobRunnerFactory());
factory.afterPropertiesSet();
channelWorker = factory.getObject();
this.channelDao = channelWorker.getChannelDao();
channelWorker.start();
// Wait for subscription of worker to the channel.
Thread.sleep(1000);
}
示例7: setupListener
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
private void setupListener(RedisSerializer<?> listenerSerializer) throws InterruptedException {
MessageListenerAdapter listener = new MessageListenerAdapter();
listener.setDelegate(new Listener(latch));
listener.setSerializer(listenerSerializer);
listener.afterPropertiesSet();
this.container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.afterPropertiesSet();
container.addMessageListener(listener, Collections.<Topic> singletonList(new ChannelTopic(TOPIC)));
container.start();
Thread.sleep(1000);
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-redis,代码行数:14,代码来源:RedisPublishingMessageHandlerTests.java
示例8: redisContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisContainer(SimpMessagingTemplate simpMessagingTemplate) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(redisConnectionFactory());
container.addMessageListener(gameMessageListener(simpMessagingTemplate), gameTopic());
container.addMessageListener(chatMessageListener(simpMessagingTemplate), chatTopic());
return container;
}
示例9: SubscriptionManagement
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Autowired
public SubscriptionManagement(
StompRedisRelayProperties properties,
RedisMessageListenerContainer redisMessageListenerContainer) {
this.properties = properties;
this.redisMessageListenerContainer = redisMessageListenerContainer;
}
示例10: redisMessageListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer(
// provided by Spring Boot
@SuppressWarnings("SpringJavaAutowiringInspection") RedisConnectionFactory redisConnectionFactory
) {
final RedisMessageListenerContainer bean = new RedisMessageListenerContainer();
bean.setConnectionFactory(redisConnectionFactory);
return bean;
}
示例11: redisMessageListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer(
RedisConnectionFactory redisConnectionFactory) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(redisConnectionFactory);
return container;
}
示例12: createDefaultListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
private RedisMessageListenerContainer createDefaultListenerContainer() {
listenerContainer = new RedisMessageListenerContainer();
managedListenerContainer = true;
listenerContainer.setConnectionFactory(getConnectionFactory());
listenerContainer.afterPropertiesSet();
listenerContainer.start();
return listenerContainer;
}
示例13: redisContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
@Bean
RedisMessageListenerContainer redisContainer() {
final RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory( jedisConnFactory() );
container.addMessageListener( sampleMessageListener(), sampleTopic() );
return container;
}
示例14: getListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
/**
* Message listener container.
*/
public RedisMessageListenerContainer getListenerContainer() {
return worker.getListenerContainer();
}
示例15: setListenerContainer
import org.springframework.data.redis.listener.RedisMessageListenerContainer; //导入依赖的package包/类
/**
* Message listener container.
*/
public void setListenerContainer(RedisMessageListenerContainer listenerContainer) {
worker.setListenerContainer(listenerContainer);
}