package com.winsea.svc.common.mq;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * 消息队列配置
 * 
 * @author SunTianjun
 */
@ConditionalOnProperty(prefix = "sys", name = "client-flag", havingValue = "B")
@Configuration
public class MessageQueueConfig {

	@Bean
	public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory redisConnectionFactory) {
		RedisMessageListenerContainer container = new RedisMessageListenerContainer();
		container.setConnectionFactory(redisConnectionFactory);
		return container;
	}

	@Bean
	public MessageQueueClient messageQueueClient() {
		return new MessageQueueClient();
	}
}