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

建设公司网站怎么弄做网站怎么设置背景

建设公司网站怎么弄,做网站怎么设置背景,乡村文化建设网站栏目设置,专业做二手房的网站有哪些一、步骤 生产者 ① 创建生产者工程 ② 添加依赖 ③ 配置整合 ④ 编写代码发送消息 消费者 ① 创建消费者工程 ② 添加依赖 ③ 配置整合 ④ 编写消息监听器 二、代码 生产者工程 1.在生产者工程和消费者工程中都导入如下依赖 dependenciesdependencydependenciesdependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion5.1.7.RELEASE/version/dependencydependencygroupIdorg.springframework.amqp/groupIdartifactIdspring-rabbit/artifactIdversion2.1.8.RELEASE/version/dependencydependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.12/version/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-test/artifactIdversion5.1.7.RELEASE/version/dependency /dependencies buildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdversion3.8.0/versionconfigurationsource1.8/sourcetarget1.8/target/configuration/plugin/plugins /build 2.生产者和消费者 导入配置文件   rabbitmq.properties rabbitmq.host43.143.246.208 rabbitmq.port5672 rabbitmq.usernameroot rabbitmq.passwordroot rabbitmq.virtual-host/itcast 3.生产者核心配置文件  spring-rabbitmq-producer.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxmlns:rabbithttp://www.springframework.org/schema/rabbitxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/rabbithttp://www.springframework.org/schema/rabbit/spring-rabbit.xsd!--加载配置文件--context:property-placeholder locationclasspath:rabbitmq.properties/!-- 定义rabbitmq connectionFactory --rabbit:connection-factory idconnectionFactory host${rabbitmq.host}port${rabbitmq.port}username${rabbitmq.username}password${rabbitmq.password}virtual-host${rabbitmq.virtual-host}/!--定义管理交换机、队列--rabbit:admin connection-factoryconnectionFactory/!--定义持久化队列不存在则自动创建不绑定到交换机则绑定到默认交换机默认交换机类型为direct名字为路由键为队列的名称--rabbit:queue idspring_queue namespring_queue auto-declaretrue/!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~广播所有队列都能收到消息~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!--定义广播交换机中的持久化队列不存在则自动创建--rabbit:queue idspring_fanout_queue_1 namespring_fanout_queue_1 auto-declaretrue/!--定义广播交换机中的持久化队列不存在则自动创建--rabbit:queue idspring_fanout_queue_2 namespring_fanout_queue_2 auto-declaretrue/!--定义广播类型交换机并绑定上述两个队列--rabbit:fanout-exchange idspring_fanout_exchange namespring_fanout_exchange auto-declaretruerabbit:bindingsrabbit:binding queuespring_fanout_queue_1/rabbit:binding queuespring_fanout_queue_2//rabbit:bindings/rabbit:fanout-exchange!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~通配符*匹配一个单词#匹配多个单词 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!--定义广播交换机中的持久化队列不存在则自动创建--rabbit:queue idspring_topic_queue_star namespring_topic_queue_star auto-declaretrue/!--定义广播交换机中的持久化队列不存在则自动创建--rabbit:queue idspring_topic_queue_well namespring_topic_queue_well auto-declaretrue/!--定义广播交换机中的持久化队列不存在则自动创建--rabbit:queue idspring_topic_queue_well2 namespring_topic_queue_well2 auto-declaretrue/rabbit:topic-exchange idspring_topic_exchange namespring_topic_exchange auto-declaretruerabbit:bindingsrabbit:binding patternroot.* queuespring_topic_queue_star/rabbit:binding patternroot.# queuespring_topic_queue_well/rabbit:binding patternitcast.# queuespring_topic_queue_well2//rabbit:bindings/rabbit:topic-exchange!--定义rabbitTemplate对象操作可以在代码中方便发送消息--rabbit:template idrabbitTemplate connection-factoryconnectionFactory/ /beans 4.测试类 ProducerTest RunWith(SpringJUnit4ClassRunner.class) ContextConfiguration(locations classpath:spring-rabbitmq-producer.xml) public class ProducerTest {//1.注入 RabbitTemplateAutowiredprivate RabbitTemplate rabbitTemplate;Testpublic void testHelloWorld(){//2.发送消息rabbitTemplate.convertAndSend(spring_queue,hello world spring....);}/*** 发送fanout消息*/Testpublic void testFanout(){//2.发送消息rabbitTemplate.convertAndSend(spring_fanout_exchange,,spring fanout....);}/*** 发送topic消息*/Testpublic void testTopic(){//2.发送消息rabbitTemplate.convertAndSend(spring_topic_exchange,root.hehe.haha,spring topic....);} } 5.运行结果  消费者工程 1、2同上述1、2 3、消费者核心配置文件 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxmlns:rabbithttp://www.springframework.org/schema/rabbitxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttps://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/rabbithttp://www.springframework.org/schema/rabbit/spring-rabbit.xsd!--加载配置文件--context:property-placeholder locationclasspath:rabbitmq.properties/!-- 定义rabbitmq connectionFactory --rabbit:connection-factory idconnectionFactory host${rabbitmq.host}port${rabbitmq.port}username${rabbitmq.username}password${rabbitmq.password}virtual-host${rabbitmq.virtual-host}/!-- 定义SpringQueueListener --bean idspringQueueListener classcom.rabbitmq.listener.SpringQueueListener/ !-- bean idfanoutListener1 classcom.rabbitmq.listener.FanoutListener1/-- !-- bean idfanoutListener2 classcom.rabbitmq.listener.FanoutListener2/-- !-- bean idtopicListenerStar classcom.rabbitmq.listener.TopicListenerStar/-- !-- bean idtopicListenerWell classcom.rabbitmq.listener.TopicListenerWell/-- !-- bean idtopicListenerWell2 classcom.rabbitmq.listener.TopicListenerWell2/--rabbit:listener-container connection-factoryconnectionFactory auto-declaretrue!-- 定义SpringQueueListener 监听哪个队列--rabbit:listener refspringQueueListener queue-namesspring_queue/ !-- rabbit:listener reffanoutListener1 queue-namesspring_fanout_queue_1/-- !-- rabbit:listener reffanoutListener2 queue-namesspring_fanout_queue_2/-- !-- rabbit:listener reftopicListenerStar queue-namesspring_topic_queue_star/-- !-- rabbit:listener reftopicListenerWell queue-namesspring_topic_queue_well/-- !-- rabbit:listener reftopicListenerWell2 queue-namesspring_topic_queue_well2/--/rabbit:listener-container /beans 4.类 SpringQueueListener public class SpringQueueListener implements MessageListener {Overridepublic void onMessage(Message message) {//打印消息System.out.println(new String(message.getBody()));} } 5.测试 RunWith(SpringJUnit4ClassRunner.class) ContextConfiguration(locations classpath:spring-rabbitmq-comsumer.xml) public class ConsumerTest {Testpublic void test1(){boolean flag true;while (true){}}}
http://www.hkea.cn/news/14404188/

相关文章:

  • 深圳建网站兴田德润优秀设计网站一般多少钱
  • 台州网站建设 网站制作 网站设计wordpress 2.5.1漏洞
  • 成都青白江网站建设苏州网站设计公司山东济南兴田德润什么活动
  • 视觉元素网站网站建设手机端页面模板
  • 对二次网站开发的认识阳江本地最新招聘信息
  • 企业网站建设设计方案高水平高职院校 建设网站
  • seo网站技术培训天元建设集团有限公司的商业承兑
  • 泰安手机网站便宜点的WordPress
  • 网页版游戏网站网站开发前端应用程序
  • 网站关键字优化公司网页设计接私单的网站
  • 东莞网上商城网站建设做3d图的网站
  • 网站制作费用入什么科目WordPress 秒开
  • 深圳做微信网站建设app制作
  • 自己做网站需要买哪些东西登记注册身份验证
  • 外贸网站推广平台wordpress图片广告代码
  • 学习网站建设课程小公司根本办不了icp许可证
  • 网站链接怎么做找熟人做网站的弊端
  • 上海公司做网站的网站建设哪些是需要外援的问题
  • 商丘网站推广公司苏州做网站专业的公司
  • 河南省建设安全监督总站网站网站建设要求说明
  • 中国水电建设集团网站fm网站开发
  • 专做机酒的网站dede织梦php文章图片网站源码 完整后台 带在线音乐
  • 网站开发自学流程国内专门做旅游攻略的网站
  • 数码类网站名称潍坊个人做网站的公司
  • 湖南天人安装建设有限公司网站什么网站建设最便宜
  • 做网站工资多少钱怎么做伪静态网站
  • 家具展示网站源码河南省建设协会网站
  • 米拓网站建设步骤微博推广价格表
  • 外贸网站使用什么品牌国外主机汽车网站建设价格
  • 网站备案信息下载wordpress js漏洞