package com.iailab.module.shasteel.mq.config; import com.iailab.module.shasteel.mq.consumer.PredictFinishMessage; import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.Queue; import org.springframework.amqp.core.TopicExchange; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author lirm * @Description * @createTime 2024年11月27日 */ @Configuration public class TopicPredictFinishRabbitConfig { //绑定键 public final static String routingPredictFinish = PredictFinishMessage.PREDICTFINISH_ROUTING_KEY; @Bean public Queue predictFinishQueue() { return new Queue(TopicPredictFinishRabbitConfig.routingPredictFinish); } @Bean TopicExchange predictFinishExchange() { return new TopicExchange(PredictFinishMessage.EXCHANGE); } // 注意通配符*和#的用法 @Bean Binding bindingExchangeMessagePF() { return BindingBuilder.bind(predictFinishQueue()).to(predictFinishExchange()).with(routingPredictFinish); } }