当前位置: 首页> 健康> 美食 > web个人博客网站_桂林旅游网官方网站_交换链接营销案例_网络推广优化服务

web个人博客网站_桂林旅游网官方网站_交换链接营销案例_网络推广优化服务

时间:2025/8/23 21:42:32来源:https://blog.csdn.net/weixin_55987175/article/details/145949386 浏览次数:0次
web个人博客网站_桂林旅游网官方网站_交换链接营销案例_网络推广优化服务

前面我们用Docker拉了rabbitMQ,并集成进了springboot,现在我们先写配置类:

package com.llpp.config;import com.llpp.service.impl.ImageServiceImpl;
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.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class RabbitMQConfig {public static final String EXCHANGE_NAME = "image_processing_exchange";public static final String QUEUE_NAME = "image_processing_queue";public static final String ROUTING_KEY = "image.processing";@Autowiredprivate ConnectionFactory connectionFactory;@Beanpublic TopicExchange exchange() {return new TopicExchange(EXCHANGE_NAME);}@Beanpublic Queue queue() {return new Queue(QUEUE_NAME, true);}@Beanpublic Binding binding(Queue queue, TopicExchange exchange) {return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);}@Beanpublic SimpleMessageListenerContainer messageListenerContainer() {SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();container.setConnectionFactory(connectionFactory);container.setQueueNames(QUEUE_NAME);container.setMessageListener(new MessageListenerAdapter(new ImageServiceImpl()));return container;}
}

关键字:web个人博客网站_桂林旅游网官方网站_交换链接营销案例_网络推广优化服务

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: