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

网站seo方案网络开发是什么专业

网站seo方案,网络开发是什么专业,东莞人才网招聘官网,网站开发小公司推荐概述#xff1a;安装看我上篇文章Docker安装rabbitmq-CSDN博客 任务一 创建一个队列 这样创建两个队列 在amq.fanout交换机里面发送数据 模拟发送数据 发送消息#xff0c;发现一下信息#xff1a; 所以得出理论#xff0c;消息发送是先到交换机#xff0c;然后由交换机…概述安装看我上篇文章Docker安装rabbitmq-CSDN博客 任务一 创建一个队列 这样创建两个队列 在amq.fanout交换机里面发送数据 模拟发送数据 发送消息发现一下信息 所以得出理论消息发送是先到交换机然后由交换机路由到消息队列 交换机是负责路由和转发消息的并没有存储的功能。 绑定队列 同理绑定queue2 这时再在交换机中发消息 查看结果 数据隔离 在rabbitmq中有虚拟主机的概念。 第一步新添用户 添加成功后发现没有虚拟主机也就是说我用这个用户登录后是不可以操作上面的数据的。 又因为我是超级管理员所以我能看到这些 所以只能看不能操作。 第二步创立自己的虚拟主机 第三步选自己的虚拟主机 选好后就只能看自己的了。 用Java代码操作 官网RabbitMQ Tutorials — RabbitMQ 可以看到官网上有案例我们大多情况下用的是SpringAmqp所以也就不讲那么多java简单调用的事情了。 用Spring AMQP操作 第一步在控制台里面创建一个simple.queue队列 第二步编写代码 pom文件 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.cyl/groupIdartifactIdtest09/artifactIdversion0.0.1-SNAPSHOT/versionnametest09/namedescriptiontest09/descriptionpropertiesjava.version1.8/java.versionproject.build.sourceEncodingUTF-8/project.build.sourceEncodingproject.reporting.outputEncodingUTF-8/project.reporting.outputEncodingspring-boot.version2.6.13/spring-boot.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-amqp/artifactId/dependencydependencygroupIdcom.rabbitmq/groupIdartifactIdamqp-client/artifactIdversion5.13.0/version/dependency/dependenciesdependencyManagementdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-dependencies/artifactIdversion${spring-boot.version}/versiontypepom/typescopeimport/scope/dependency/dependencies/dependencyManagementbuildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdversion3.8.1/versionconfigurationsource1.8/sourcetarget1.8/targetencodingUTF-8/encoding/configuration/pluginplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdversion${spring-boot.version}/versionconfigurationmainClassorg.cyl.test09.Test09Application/mainClassskiptrue/skip/configurationexecutionsexecutionidrepackage/idgoalsgoalrepackage/goal/goals/execution/executions/plugin/plugins/build/project配置mq服务端消息 spring:rabbitmq:host: 192.168.56.10port: 5672virtual-host: /cmallusername: cmallpassword: 123456 发送方 package org.cyl.test09.demos;import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;Service public class SendMessageService {Autowiredprivate RabbitTemplate rabbitTemplate;public void testSimpleQueue(){String queueNamesimple.queue;String messagehello,spring amqp!;rabbitTemplate.convertAndSend(queueName,message);}public void sendMessage(String exchange, String routingKey, Object message) {rabbitTemplate.convertAndSend(exchange, routingKey, message);} }接收方 package org.cyl.test09.demos;import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Service;Service public class ReceiveMessageService {RabbitListener(queues simple.queue)public void receiveMessage(String message) {System.out.println(接收到的消息 message);} }controller类 package org.cyl.test09.demos.controller;import org.cyl.test09.demos.ReceiveMessageService; import org.cyl.test09.demos.SendMessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;RestController public class HelloController {AutowiredSendMessageService sendMsgservice;AutowiredReceiveMessageService receiveMsgService;GetMapping(/send)public String send(){sendMsgservice.testSimpleQueue();return ok;}}展示结果 Work模型 第一步创建一个队列 第二步编写代码 发送 package org.cyl.test09.demos;import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;Service public class SendMessageService {Autowiredprivate RabbitTemplate rabbitTemplate;public void testSimpleQueue() throws InterruptedException {String queueNamework.queue;for (int i1;i50;i){String messagehello,spring amqp!_i;rabbitTemplate.convertAndSend(queueName,message);Thread.sleep(20);}}public void sendMessage(String exchange, String routingKey, Object message) {rabbitTemplate.convertAndSend(exchange, routingKey, message);} }接收 package org.cyl.test09.demos;import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Service;Service public class ReceiveMessageService {RabbitListener(queues work.queue)public void receiveMessage1(String message) {System.out.println(消费者1接收到的消息 message);}RabbitListener(queues work.queue)public void receiveMessage2(String message) {System.out.println(消费者2接收到的消息 message);} }结果展示 消费者一和消费者二是轮询效果。 Fanout交换机 第一步创建队列 第二步创建交换机并绑定 第三步编写代码 发送端 public void testFanout() {String exchangeNamecmall.fanout;String messagehello,spring everyone;rabbitTemplate.convertAndSend(exchangeName,null,message);} 接收端 RabbitListener(queues fanout.queue1)public void receiveMessage3(String message) {System.out.println(消费者1接收到的消息 message);}RabbitListener(queues fanout.queue2)public void receiveMessage4(String message) {System.out.println(消费者2接收到的消息 message);} 展示结果 私发给不同的人Direct交换机 第一步创建两个队列 第二步声明交换机并绑定 第三步编写代码 接收方 RabbitListener(queues direct.queue1)public void receiveMessage5(String message) {System.out.println(消费者1接收到的消息 message);}RabbitListener(queues direct.queue2)public void receiveMessage6(String message) {System.out.println(消费者2接收到的消息 message);} 发送方 public void testDirect1() {String exchangeNamecmall.fanout;String messagehello,spring everyone;rabbitTemplate.convertAndSend(exchangeName,red,message);}public void testDirect2() {String exchangeNamecmall.fanout;String messagehello,spring blue;rabbitTemplate.convertAndSend(exchangeName,blue,message);}public void testDirect3() {String exchangeNamecmall.fanout;String messagehello,spring yellow;rabbitTemplate.convertAndSend(exchangeName,yellow,message);} Topic交换机 这个示例代码就懒得写了。 声明交换机和队列1 绑定队列到哪个交换机里面。 一般建立关系都是在消费者这边的。 声明交换机和队列2 基于注解式声明队列和交换机。 消息转换器 字节码可变会有安全问题。 搞完以上东西代码不用变在发一次即可为json。 好了基础讲完。
http://www.w-s-a.com/news/822994/

相关文章:

  • 高校网站建设前言做公众号的公司是什么公司
  • 网站备案怎么登陆短视频培训学校
  • 百度图片点击变网站是怎么做的北京市建设工程质量监督站网站
  • 在线建站模板重庆网站建设大概需要多少钱
  • 建设网站公司电话号码wordpress 即时通讯
  • 网站设计用的技术拓者吧室内设计网app
  • 河北seo优化_网络建设营销_网站推广服务 - 河北邢台seo网站建设运行情况报告
  • 建设银行内部网站6画册设计是什么
  • 网站建设什么价格网站下拉菜单怎么做
  • flash型网站微信公众号运营策划
  • 想建设个网站怎么赚钱国外学校网站设计
  • 网站设计网页设计系统没有安装wordpress
  • 建网站做哪方面公司百度官网优化
  • 山西网站seo网站采集信息怎么做
  • 同江佳木斯网站建设seo学徒培训
  • 淘宝不能发布网站源码做商品怀化网站制作建设
  • 买空间哪个网站好做我的世界背景图的网站
  • 南京哪里做网站wordpress 增加子目录
  • 刚做的网站搜全名查不到网站很难被百度收录
  • 网站建设与管理期末做网站买空间用共享ip
  • 网络合同怎么签有效南京seo公司哪家
  • 厦门建设网官方网站上海网络网站建
  • 网站制作西安郑州网站建设动态
  • 外贸网站免费推广温州做网站技术员
  • 武冈 网站建设做网站能收回吗
  • 网站做前端把网站扒下来以后怎么做
  • 网站模板素材下载手机做任务佣金的网站
  • 机关网站建设考核测评总结做网站sqlserver排序
  • 凉山州建设厅官方网站html5下载教程
  • 内网网站建设方面政策id97网站怎么做的