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

建设公司网站怎么弄网站建设答辩ppt模板

建设公司网站怎么弄,网站建设答辩ppt模板,织梦系统做的网站打开慢,汇鑫网站建设便捷一、步骤 生产者 ① 创建生产者工程 ② 添加依赖 ③ 配置整合 ④ 编写代码发送消息 消费者 ① 创建消费者工程 ② 添加依赖 ③ 配置整合 ④ 编写消息监听器 二、代码 生产者工程 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/14258252/

相关文章:

  • 泰安市网站建设怎么挑选网站建设公司
  • 炫酷网站建设wordpress 4.8 zh cn
  • 网站空间可以换吗新乡seo顾问
  • 镇江电子商务网站建设常州外贸人才网
  • 网站建设资金预算wordpress如何访问量
  • 成都公司建网站建站塔山双喜
  • 东台网站建设找哪家好外贸google推广
  • 宁波网站建设选择荣胜网络wordpress 地区插件
  • 网站建设和推广话术6山东济宁
  • 免费建工作室网站网页设计公司兴田德润i优惠吗
  • 如何利用模板建站高端品牌网站建设兴田德润实力强
  • 网站推广的基本方法是什么专做实习生招聘的网站
  • 襄樊市网站建设易语言用客户端和服务器做网站
  • php培训机构企业做网站网站需要优化的小型公司
  • 企网官方网站婚纱网站建设目的
  • 深圳网站开发语言网站怎么做谷歌推广
  • 网站建设sql语句留言板网页设计图片叠加
  • 全栈网站开发关键词优化seo费用
  • 磁力链接 网站怎么做的模板网站的缺点
  • 长春网站推广优化网站开发建设付款方式
  • wordpress 小说多站网站建设单位不给数据库
  • 视觉营销网站企业网站优化推广
  • 廊坊做网站的公司计算机网络技术主修课程
  • 各大网站vip接口建设uc浏览器网页版打开
  • 企业建设网站流程图长春网站建设880元
  • 开一个个人网站多少钱百度seo排名优
  • 给别人做网站多少钱国内做钢铁的网站
  • 西安网站搭建的公司建站技巧
  • 网站群建设费用外贸出口退税流程
  • 农业信息网站建设烟台网站制作建设