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

在哪里打广告效果最好百度搜索引擎seo

在哪里打广告效果最好,百度搜索引擎seo,网站备案的影布怎么做,做电商网站都需要学什么条件1. 项目问题分析 现在项目中有三个独立的微服务#xff1a; 商品微服务#xff1a;原始数据保存在 MySQL 中#xff0c;从 MySQL 中增删改查商品数据。搜索微服务#xff1a;原始数据保存在 ES 的索引库中#xff0c;从 ES 中查询商品数据。商品详情微服务#xff1a;做…1. 项目问题分析 现在项目中有三个独立的微服务 商品微服务原始数据保存在 MySQL 中从 MySQL 中增删改查商品数据。搜索微服务原始数据保存在 ES 的索引库中从 ES 中查询商品数据。商品详情微服务做了页面静态化静态页面的商品数据不会随着数据库发生变化。 假如我在商品微服务中修改了商品的数据也就是 MySQL 中数据发生了改变。但搜索微服务查询到的数据还是原来的商品详情微服务的生成的静态页面也没有发生改变这样显然不对。我们需要实现数据的同步让搜索微服务和商品详情微服务的商品也发生修改。 我们使用消息队列技术RabbitMQ来实现数据同步 2. 项目改造 接下来我们就改造项目实现搜索微服务和商品详情微服务的数据同步。 2.1 改造思路 生产者商品微服务 什么时候发送消息 当商品微服务对商品进行增、删、改的操作时候就发送一条消息。 发送什么内容 我们发送商品 id其它微服务可以根据 id 查询自己需要的信息。 消费者搜索微服务和商品详情微服务 接收消息后如何处理 搜索微服务 增/改添加新的数据到索引库删删除索引库数据商品详情微服务 增/改创建新的静态页删删除原来的静态页 2.2 商品微服务发送消息 在 leyou-item-service 中实现商品微服务发送消息。 2.2.1 引入依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-amqp/artifactId /dependency2.2.2 配置文件 在 application.yaml 中添加 RabbitMQ 的配置 spring:rabbitmq:host: 127.0.0.1username: leyoupassword: leyouvirtual-host: /leyoutemplate:exchange: leyou.item.exchangepublisher-confirms: truetemplate有关 AmqpTemplate 的配置 exchange缺省的交换机名称此处配置后发送消息如果不指定交换机就会使用这个publisher-confirms生产者确认机制确保消息会正确发送如果发送失败会有错误回执从而触发重试 2.2.3 改造 SpuService 注入 AmpqTemplate 模板 Autowired private AmqpTemplate amqpTemplate;编写发送消息方法 /*** 发送消息* param id 商品 id* param type*/ private void sendMessage(Long id, String type){try {this.amqpTemplate.convertAndSend(item. type, id);} catch (Exception e) {e.printStackTrace();} }在新增方法中调用发送消息方法 在修改方法中调用发送消息方法 2.3 搜索微服务接收消息 在 leyou-search 中实现搜索微服务接收消息。 2.3.1 引入依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-amqp/artifactId /dependency2.3.2 配置文件 spring:rabbitmq:host: 127.0.0.1username: leyoupassword: leyouvirtual-host: /leyou2.3.3 编写监听器 Component public class GoodsListener {Autowiredprivate SearchService searchService;/*** 处理 insert 和 update 的消息** param id* throws Exception*/RabbitListener(bindings QueueBinding(value Queue(value leyou.create.index.queue, durable true),exchange Exchange(value leyou.item.exchange,ignoreDeclarationExceptions true,type ExchangeTypes.TOPIC),key {item.insert, item.update}))public void listenCreate(Long id) throws Exception {if (id null) {return;}// 创建或更新索引this.searchService.createIndex(id);}/*** 处理 delete 的消息** param id*/RabbitListener(bindings QueueBinding(value Queue(value leyou.delete.index.queue, durable true),exchange Exchange(value leyou.item.exchange,ignoreDeclarationExceptions true,type ExchangeTypes.TOPIC),key item.delete))public void listenDelete(Long id) {if (id null) {return;}// 删除索引this.searchService.deleteIndex(id);} }2.3.4 编写创建和删除索引方法 在 SearchService 中添加创建和删除索引方法 /*** 创建索引** param id* throws IOException*/ public void createIndex(Long id) throws IOException {Spu spu this.spuClient.querySpuById(id);// 构建商品Goods goods this.buildGoods(spu);// 保存数据到索引库this.goodsRepository.save(goods); }/*** 删除索引** param id*/ public void deleteIndex(Long id) {this.goodsRepository.deleteById(id); }2.4 商品详情微服务接收消息 在 leyou-goods-web 中实现商品详情微服务接收消息。 2.4.1 引入依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-amqp/artifactId /dependency2.4.2 配置文件 spring:rabbitmq:host: 127.0.0.1username: leyoupassword: leyouvirtual-host: /leyou2.4.3 编写监听器 Component public class GoodsListener {Autowiredprivate GoodsHtmlService goodsHtmlService;/*** 处理 insert 和 update 的消息** param id* throws Exception*/RabbitListener(bindings QueueBinding(value Queue(value leyou.create.web.queue, durable true),exchange Exchange(value leyou.item.exchange,ignoreDeclarationExceptions true,type ExchangeTypes.TOPIC),key {item.insert, item.update}))public void listenCreate(Long id) throws Exception {if (id null) {return;}// 创建页面goodsHtmlService.createHtml(id);}/*** 处理 delete 的消息** param id*/RabbitListener(bindings QueueBinding(value Queue(value leyou.delete.web.queue, durable true),exchange Exchange(value leyou.item.exchange,ignoreDeclarationExceptions true,type ExchangeTypes.TOPIC),key item.delete))public void listenDelete(Long id) {if (id null) {return;}// 删除页面goodsHtmlService.deleteHtml(id);} }2.4.4 添加删除页面方法 在 GoodsHtmlService 中 添加删除页面方法 /*** 删除 HTML 页面* param id*/ public void deleteHtml(Long id) {File file new File(D:\\nginx-1.14.0\\html\\item\\ id .html);file.deleteOnExit(); }3. 测试 启动微服务 打开 RabbitMQ 管理界面交换机和队列都已将创建好了 启动后台管理系统和门户系统 查看搜索商品页和商品详情页 进入后台管理系统修改商品价格为 4999
http://www.pierceye.com/news/74574/

相关文章:

  • 网站建设公司网站制作免费网站建设那个好
  • 企业网站建设中简述电子商务网站建设的主要步骤
  • 做网站赚广告费好做吗阳江招聘网最新招聘信息网美容框
  • 西安网站开发公司地址软件开发外包方案
  • 服务好的企业建站三门峡高端网站建设
  • 天津住房城乡建设网站wordpress采集淘宝 插件
  • 校园文化宣传主题网站的建设打广告的平台
  • 寮步网站建设哪家好企网站的互联网
  • 网站seo优缺点技术支持网站
  • 网站主题制作东莞网约车平台
  • 登录住房城乡建设部官方网站莱芜二手房网站
  • wordpress如何添加注册登录seo查询工具
  • 电商网站开发流程文档做网站手机电脑通用要加些什么
  • 石家庄网站建设企业设计竞赛网
  • 成都 广告公司网站建设成都网站制作售后
  • 如何做双语网站设计的比较好的网站
  • 深圳网站建设网站制作网站推广wordpress-zh
  • 村级网站建设系统淘宝客建立网站推广怎么做
  • 建设网站需要什么硬件设施有了自己的网站怎样做后台
  • 如何做本地门户网站wordpress站点费用
  • 值得信赖的深圳app开发公司seo资料站
  • 西安网站建设seo竞价网站流量排名查询工具
  • wordpress改变登录地址网站关键词优化哪家正规
  • 一般网站海报做一张多久国际人才网中山招聘网
  • 在线定制网站官网境外电商是做什么的
  • 《21天网站建设实录mysql进程太多wordpress
  • html网站建设实例教程ssr网站开发
  • 网站如何提交百度收录深圳建设局投标网站
  • 华为公司网站建设相关内容青岛商城网站建设设计
  • 做文案图片上什么网站wordpress 发布网站