package com.zy.acs.hex.constant; /** * RabbitMQ核心配置类,定义交换机、队列和绑定关系 * * @author ken */ public class RabbitConstant { public static final String DURABLE = "true"; public static final String TOPIC_EXCHANGE_TYPE = "topic"; // ========================== 主题模式 ========================== /** * 主题交换机名称 */ public static final String TOPIC_EXCHANGE = "rcs_topic_exchange"; /** * 主题队列1(上行) */ public static final String TOPIC_QUEUE_UP = "TOPIC_QUEUE_UP"; /** * 主题队列2(下行) */ public static final String TOPIC_QUEUE_DOWN = "TOPIC_QUEUE_DOWN"; // 属性 服务 事件 //Properties, services, and events /** * 上行路由键前缀,第一个代表设备编号,第二个代表类型 */ public static final String ROUTING_KEY_UP = "rcs.up.*.*"; /** * 下行路由键前缀,第一个代表设备编号,第二个代表类型 */ public static final String ROUTING_KEY_DOWN = "rcs.down.*.*"; /** * 创建主题交换机 * * @return 交换机实例 */ // @Bean // public TopicExchange topicExchange() { // return new TopicExchange(TOPIC_EXCHANGE, true, false); // } // /** // * 创建上行主题队列 // * // * @return 队列实例 // */ // @Bean // public Queue topicQueueUp() { // return QueueBuilder.durable(TOPIC_QUEUE_UP) // .autoDelete() // .exclusive() // .build(); // } // // /** // * 创建下行主题队列 // * // * @return 队列实例 // */ // @Bean // public Queue topicQueueDown() { // return QueueBuilder.durable(TOPIC_QUEUE_DOWN) // .exclusive() // .build(); // } // // // // /** // * 绑定上行队列到主题交换机 // * // * @return 绑定关系 // */ // @Bean // public Binding topicBindingOrder() { // return BindingBuilder.bind(topicQueueUp()) // .to(topicExchange()) // .with(ROUTING_KEY_UP); // } // // /** // * 绑定下行队列到主题交换机 // * // * @return 绑定关系 // */ // @Bean // public Binding topicBindingUser() { // return BindingBuilder.bind(topicQueueDown()) // .to(topicExchange()) // .with(ROUTING_KEY_DOWN); // } }