当前位置: 首页 > news >正文

网站制作大概需要多少钱网站建设原则应考虑哪些内容

网站制作大概需要多少钱,网站建设原则应考虑哪些内容,网站统计帮哪个好,宜昌网站制作公司前言:只有消费者部分,没有记录生产者部分 结构图 配置类 可以xml配置,也可以配置类,二者可以相互转化。两种bean注入的方式。 import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.spring…

前言:只有消费者部分,没有记录生产者部分

结构图

在这里插入图片描述

配置类

可以xml配置,也可以配置类,二者可以相互转化。两种bean注入的方式。


import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class DbDataQueueConsumeConfig {@Value("${rabbitmq.host}")private String host;@Value("${rabbitmq.port:5672}")
//    @Value("#{new Integer('${rabbitmq.port}')}")private Integer port;@Value("${rabbitmq.username}")private String username;@Value("${rabbitmq.password}")private String password;@Value("${rabbitmq.virtual-host}")private String virtualHost;@Value("${rabbitmq.queue}")private String queueName;/*** 配置连接工厂*/@Bean(name = "rabbitConnectionFactory")public ConnectionFactory connectionFactory() {CachingConnectionFactory connectionFactory = new CachingConnectionFactory();connectionFactory.setHost(host);connectionFactory.setPort(port);connectionFactory.setUsername(username);connectionFactory.setPassword(password);connectionFactory.setVirtualHost(virtualHost);return connectionFactory;}/*** 配置 RabbitTemplate,用于发送消息*/@Beanpublic RabbitTemplate rabbitTemplate(@Qualifier("rabbitConnectionFactory") ConnectionFactory connectionFactory) {RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);rabbitTemplate.setMessageConverter(jsonMessageConverter());return rabbitTemplate;}@Beanpublic Jackson2JsonMessageConverter jsonMessageConverter() {return new Jackson2JsonMessageConverter();}/*** 配置消息监听容器*/@Beanpublic MessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory, BdDataQueueListener bdDataQueueListener) {SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();container.setConnectionFactory(connectionFactory);container.setQueueNames(queueName);container.setMessageListener(new MessageListenerAdapter(bdDataQueueListener));return container;}}

配置文件中配置好rabbitmq服务的地址

rabbitmq.host=xxx.xxx.xxx.xxx
rabbitmq.port=3011
rabbitmq.username=username
rabbitmq.password=password
rabbitmq.virtual-host=/xxx
rabbitmq.queue=queuename

消费者

@Component
public class BdDataQueueListener implements MessageListener {@Overridepublic void onMessage(Message message) {try {// 这里写业务逻辑} catch (Exception e) {}}}

重要部分都在上面。其余的不在放出来。

参考文章

文章1

文章2

http://www.yayakq.cn/news/198891/

相关文章:

  • 做分享网站网站建设后期需要后期做的
  • 协会网站改版建议wordpress国内加速
  • 郑州网站建站wordpress做购物网站
  • 十大网站管理系统生肖竞猜网站建设
  • 超值的郑州网站建设wordpress通用页面模板下载
  • 网站性质国际十大公关公司
  • 有那种网站么北京十大必逛的商场
  • 石岩做网站哪家好苏州住房和城乡建设厅网站
  • 青岛市建设监理网站商城网站建设的步骤
  • 网站曝光率做游戏网站用什么系统做
  • 网站建设内容录入论文项目计划书范文免费
  • 网站建设longda网站免费空间免备案
  • 不会建网站怎么赚钱网站用什么布局
  • 网站导航设计欣赏wordpress导航加tu
  • 网站开发需要提供哪些资料印象庆阳网
  • 上海做网站就用乐云seo十年网站音乐播放代码
  • 布吉网站开发4米高挡土墙模板加固
  • 南昌旅游网站建设方案国内外公司网站差异
  • 企业网站优化技巧政务网站开发
  • 青海省西宁市住房城乡建设厅网站陕西省工程造价信息网官网
  • 建设门户网站多少钱徐州专业做网站的
  • 怎么做英文网站wordpress目录主题
  • 顺的网站建设策划巴中企业网站建设
  • 想要黑掉一个网站 要怎么做手机版 网站建设
  • 出入库管理系统免费版湛江网站建设优化建站
  • 网站建设的技术风险分析与规避上街郑州网站建设
  • 网站用asp还是php网站布局用什么代码
  • php大流量网站开发规范东营市城乡建设信息网
  • 淘宝上网站开发退款怎么做免费视频网站吗
  • 网站开发人员属于什么软件我的世界做墙纸网站