本文整理汇总了Java中org.springframework.data.redis.listener.adapter.MessageListenerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java MessageListenerAdapter类的具体用法?Java MessageListenerAdapter怎么用?Java MessageListenerAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageListenerAdapter类属于org.springframework.data.redis.listener.adapter包,在下文中一共展示了MessageListenerAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listenerAdapter
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter listenerAdapter(RedisReceiver receiver)
{
/*
* The message listener adapter is also configured to call the
* receiveMessage() method on Receiver when a message arrives
*/
return new MessageListenerAdapter(receiver, "receiveMessage");
}
示例2: listenerAdapter
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
public MessageListenerAdapter listenerAdapter() {
return new MessageListenerAdapter((MessageListener) (message, bytes) -> {
byte[] body = message.getBody();
try {
testStart(new String(body, Charset.defaultCharset()));
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
});
}
示例3: setupListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的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
示例4: redisMessageListenerContainer
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
public RedisMessageListenerContainer redisMessageListenerContainer(
RedisConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(listenerAdapter, new PatternTopic("__key*__:*"));
return container;
}
示例5: listenerAdapter
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter listenerAdapter(Receiver receiver) {
return new MessageListenerAdapter(receiver, "receiveMessage");
}
示例6: messageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter messageListener() {
return new MessageListenerAdapter(new MessageSubscriber());
}
示例7: messageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter messageListener() {
return new MessageListenerAdapter(new RedisInfoSubscriber());
}
示例8: listenerAdapter
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter listenerAdapter(Consumer consumer) {
return new MessageListenerAdapter(consumer, "messageHandler");
}
示例9: listenerAdapter
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter listenerAdapter(CompletedPomodoroNotifier receiver) {
return new MessageListenerAdapter(receiver, "notifyUser");
}
示例10: gameMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
public MessageListener gameMessageListener(SimpMessagingTemplate simpMessagingTemplate) {
return new MessageListenerAdapter(new GameEventConsumer(simpMessagingTemplate));
}
示例11: chatMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
public MessageListener chatMessageListener(SimpMessagingTemplate simpMessagingTemplate) {
return new MessageListenerAdapter(new ChatEventConsumer(simpMessagingTemplate));
}
示例12: creditApplicationApprovedMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter creditApplicationApprovedMessageListener(CreditApplicationApprovedEventReceiver receiver) {
MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(receiver, "receiveMessage");
messageListenerAdapter.setSerializer(new Jackson2JsonRedisSerializer<CreditApplicationApprovedEvent>(CreditApplicationApprovedEvent.class));
return messageListenerAdapter;
}
示例13: creditApplicationDeclinedMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter creditApplicationDeclinedMessageListener(CreditApplicationDeclinedEventReceiver receiver) {
MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(receiver, "receiveMessage");
messageListenerAdapter.setSerializer(new Jackson2JsonRedisSerializer<CreditApplicationDeclinedEvent>(CreditApplicationDeclinedEvent.class));
return messageListenerAdapter;
}
示例14: customerCreatedMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter customerCreatedMessageListener(CustomerCreatedEventReceiver receiver) {
MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(receiver, "receiveMessage");
messageListenerAdapter.setSerializer(new Jackson2JsonRedisSerializer<CustomerCreatedEvent>(CustomerCreatedEvent.class));
return messageListenerAdapter;
}
示例15: sampleMessageListener
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; //导入依赖的package包/类
@Bean
MessageListenerAdapter sampleMessageListener() {
return new MessageListenerAdapter( new MessageListenerImpl() );
}