All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zznote.basecommon.common.config.rabbitmq.DirectRabbitConfig Maven / Gradle / Ivy

The newest version!
package com.zznote.basecommon.common.config.rabbitmq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * direct模式
 * @Author: zhangzhen
 * @date 2022/2/11
 */
@Configuration
public class DirectRabbitConfig {
	//操作日志队列
	@Bean
	public Queue directLogQueue() {
		return new Queue("log.direct.queue", true);
	}
	//登陆日志队列
	@Bean
	public Queue directLoginQueue() {
		return new Queue("login.direct.queue", true);
	}
	//direct交换机 起名:direct_order_exchange
	@Bean
	public DirectExchange directLogExchange() {
		return new DirectExchange("direct_log_exchange", true, false);
	}
	//绑定  将队列和交换机绑定, 并设置用于匹配键:log
	@Bean
	public Binding bindingDirect1() {
		return BindingBuilder.bind(directLogQueue()).to(directLogExchange()).with("log");
	}
	@Bean
	public Binding bindingDirect2() {
		return BindingBuilder.bind(directLoginQueue()).to(directLogExchange()).with("login");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy