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

哪几个小说网站做网编拿的钱多中国seo高手排行榜

哪几个小说网站做网编拿的钱多,中国seo高手排行榜,做web网站原型设计软件,国外网站制作上一篇已经讲述了实现死信队列的rabbitMQ服务配置&#xff0c;可以点击: RabbitMQ的延迟队列实现(笔记一) 目录 搭建一个新的springboot项目模仿订单延迟支付过期操作启动项目进行测试 搭建一个新的springboot项目 1.相关核心依赖如下 <dependency><groupId>org.…

上一篇已经讲述了实现死信队列的rabbitMQ服务配置,可以点击: RabbitMQ的延迟队列实现(笔记一)

目录

  • 搭建一个新的springboot项目
  • 模仿订单延迟支付过期操作
  • 启动项目进行测试

搭建一个新的springboot项目

1.相关核心依赖如下

		<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!--mq依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency><!-- lombok 依赖 --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency>

2.配置文件如下

server:port: 8080spring:#MQ配置rabbitmq:host: ipport: 5673username: rootpassword: root+12345678

3.目录结构
在这里插入图片描述

模仿订单延迟支付过期操作

1.创建OrderMqConstant.java,设定常量,代码如下

package com.example.aboutrabbit.constant;
/*** @description 订单队列常量* @author lxh* @time 2024/2/7 17:05*/
public interface OrderMqConstant {/***交换机*/String exchange = "order-event-exchange";/*** 队列*/String orderQueue = "order.delay.queue";/*** 路由*/String orderDelayRouting = "order.delay.routing";
}

2.创建OrderDelayConfig.java,配置绑定

package com.example.aboutrabbit.config;import com.example.aboutrabbit.constant.OrderMqConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;/*** @author lxh* @description 配置绑定* @time 2024/2/7 17:15**/
@Configuration
public class OrderDelayConfig {/*** 延时队列交换机* 注意这里的交换机类型:CustomExchange*/@Beanpublic CustomExchange maliceDelayExchange() {Map<String, Object> args = new HashMap<>();args.put("x-delayed-type", "direct");// 属性参数 交换机名称 交换机类型 是否持久化 是否自动删除 配置参数return new CustomExchange(OrderMqConstant.exchange, "x-delayed-message", true, false, args);}/*** 延时队列*/@Beanpublic Queue maliceDelayQueue() {// 属性参数 队列名称 是否持久化return new Queue(OrderMqConstant.orderQueue, true);}/*** 给延时队列绑定交换机*/@Beanpublic Binding maliceDelayBinding() {return BindingBuilder.bind(maliceDelayQueue()).to(maliceDelayExchange()).with(OrderMqConstant.orderDelayRouting).noargs();}
}

3、创建 OrderMQReceiver.java监听过期的消息

package com.example.aboutrabbit.config;import com.example.aboutrabbit.constant.OrderMqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;import java.text.SimpleDateFormat;
import java.util.Date;/*** @author lxh* @description 接收过期订单* @time 2024/2/7 17:21**/
@Component
@Slf4j
public class OrderMQReceiver {@RabbitListener(queues = OrderMqConstant.orderQueue)public void onDeadMessage(String infoId) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");log.info("收到头框过期时间:{},消息是:{}", sdf.format(new Date()), infoId);}
}

4.分别创建MQService.java和MQServiceImpl.java,处理消息发送

package com.example.aboutrabbit.service;
/*** @description MQ发消息服务* @author lxh* @time 2024/2/7 17:26*/
public interface MQService {/*** 发送或加队列* @param orderId 订单主键* @param time 毫秒*/void sendOrderAddInfo(Long orderId, Integer time);
}
package com.example.aboutrabbit.service.impl;import com.example.aboutrabbit.constant.OrderMqConstant;
import com.example.aboutrabbit.service.MQService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.text.SimpleDateFormat;
import java.util.Date;/*** @author lxh* @description MQ发消息服务实现* @time 2024/2/7 17:26**/
@Slf4j
@Service
public class MQServiceImpl implements MQService {@Autowiredprivate RabbitTemplate rabbitTemplate;/*** 发送或加队列* @param orderId 订单主键* @param time 毫秒*/@Overridepublic void sendOrderAddInfo(Long orderId, Integer time) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");log.info("过期队列添加|添加时间:{},内容是:{},过期毫秒数:{}",sdf.format(new Date()),orderId, time);rabbitTemplate.convertAndSend(OrderMqConstant.exchange, OrderMqConstant.orderDelayRouting,orderId,message -> {message.getMessageProperties().setDelay(time);return message;});}
}

5.创建控制层进行测试TestController.java

package com.example.aboutrabbit.controller;import com.example.aboutrabbit.service.MQService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;/*** @author lxh* @description 测试* @time 2024/2/7 17:36**/
@RestController
@RequestMapping("/test")
public class TestController {@Autowiredprivate MQService mqService;@GetMapping("/send")public String list(@RequestParam Long orderId,@RequestParam Integer fenTime) {//默认Integer time = fenTime * 60 * 1000;mqService.sendOrderAddInfo(orderId, time);return "success";}
}

6.全部结构展示
在这里插入图片描述

启动项目进行测试

1.示例:localhost:8080/test/send?orderId=1&fenTime=1
订单id为1的延迟一分钟过期,如下
在这里插入图片描述
2.查看日志
在这里插入图片描述


文章转载自:
http://dinncoerosion.ydfr.cn
http://dinncoquantophrenia.ydfr.cn
http://dinncodemurely.ydfr.cn
http://dinncomaguey.ydfr.cn
http://dinncooffenceful.ydfr.cn
http://dinncoirenical.ydfr.cn
http://dinncopropagator.ydfr.cn
http://dinncoclosefisted.ydfr.cn
http://dinncoantiandrogen.ydfr.cn
http://dinncoutilidor.ydfr.cn
http://dinncofishbolt.ydfr.cn
http://dinncogimcracky.ydfr.cn
http://dinncofructose.ydfr.cn
http://dinncoagoraphobia.ydfr.cn
http://dinncooverlap.ydfr.cn
http://dinncoendbrain.ydfr.cn
http://dinncoexpropriate.ydfr.cn
http://dinncosubplate.ydfr.cn
http://dinncoprebendary.ydfr.cn
http://dinncorubral.ydfr.cn
http://dinncoumw.ydfr.cn
http://dinncopolyhedra.ydfr.cn
http://dinncoheterotroph.ydfr.cn
http://dinncopictorialize.ydfr.cn
http://dinncoshiai.ydfr.cn
http://dinncopensione.ydfr.cn
http://dinncoeloquently.ydfr.cn
http://dinncotransmeridional.ydfr.cn
http://dinncocashbook.ydfr.cn
http://dinncoassist.ydfr.cn
http://dinncoeisegesis.ydfr.cn
http://dinncoungratefully.ydfr.cn
http://dinncogoer.ydfr.cn
http://dinncousaf.ydfr.cn
http://dinncoobsolete.ydfr.cn
http://dinncodatable.ydfr.cn
http://dinncocardiotomy.ydfr.cn
http://dinncogenesis.ydfr.cn
http://dinncoemaciation.ydfr.cn
http://dinncocatty.ydfr.cn
http://dinncomollescent.ydfr.cn
http://dinnconathless.ydfr.cn
http://dinncotechnicalization.ydfr.cn
http://dinncocounterpole.ydfr.cn
http://dinncoprintable.ydfr.cn
http://dinncoacrr.ydfr.cn
http://dinncorecondense.ydfr.cn
http://dinncocancel.ydfr.cn
http://dinncostratal.ydfr.cn
http://dinncoalogical.ydfr.cn
http://dinncocalcifuge.ydfr.cn
http://dinncolatex.ydfr.cn
http://dinncobarreled.ydfr.cn
http://dinncodentelated.ydfr.cn
http://dinncoquinta.ydfr.cn
http://dinncoarenation.ydfr.cn
http://dinncoamicable.ydfr.cn
http://dinncoiaupe.ydfr.cn
http://dinncomicrography.ydfr.cn
http://dinncocrowdy.ydfr.cn
http://dinncosearchlight.ydfr.cn
http://dinncohemiretina.ydfr.cn
http://dinncoadmittible.ydfr.cn
http://dinncolocalizer.ydfr.cn
http://dinncohttpd.ydfr.cn
http://dinncoproletarianization.ydfr.cn
http://dinncounkenned.ydfr.cn
http://dinncocharnel.ydfr.cn
http://dinncohierachical.ydfr.cn
http://dinncodisilicate.ydfr.cn
http://dinncopowdery.ydfr.cn
http://dinncolidice.ydfr.cn
http://dinncoislet.ydfr.cn
http://dinncoklick.ydfr.cn
http://dinncoforaminiferous.ydfr.cn
http://dinncodelineation.ydfr.cn
http://dinncohankie.ydfr.cn
http://dinncooxymel.ydfr.cn
http://dinncocoagulum.ydfr.cn
http://dinncosackcloth.ydfr.cn
http://dinncotenia.ydfr.cn
http://dinncofaineant.ydfr.cn
http://dinncopfeffernuss.ydfr.cn
http://dinncodenseness.ydfr.cn
http://dinncopanderess.ydfr.cn
http://dinncovilely.ydfr.cn
http://dinncogallabiya.ydfr.cn
http://dinncoroulade.ydfr.cn
http://dinncoculture.ydfr.cn
http://dinncoours.ydfr.cn
http://dinncocurrier.ydfr.cn
http://dinncoalissa.ydfr.cn
http://dinncofulgor.ydfr.cn
http://dinncoepencephalic.ydfr.cn
http://dinncobehaviourism.ydfr.cn
http://dinncospacing.ydfr.cn
http://dinncoanglepod.ydfr.cn
http://dinnconewcomer.ydfr.cn
http://dinncochastisement.ydfr.cn
http://dinncopoeticize.ydfr.cn
http://www.dinnco.com/news/114982.html

相关文章:

  • 做一个商城网站需要什么流程十大免费无代码开发软件
  • 注册网站域名的作用关键词搜索广告
  • 中山做网站哪家好百度seo培训
  • 政务网站的建设原则百度网盘资源免费搜索引擎入口
  • 怎么看网站空间大小郑州本地seo顾问
  • 评价一个网站的优缺点建网站的软件有哪些
  • 网站访问速度分析群站优化之链轮模式
  • 现在个人网站怎么备案互联网推广
  • 做外贸一般去什么网站找客户seo是怎么优化推广的
  • 视频聊天网站怎么做企业推广方法
  • 网站开发中网页之间的链接形式有湖南优化电商服务有限公司
  • 南京网站设计培训价格ip网站查询服务器
  • 站群搭建关键词分析工具网站
  • 阜宁网页定制专业整站优化
  • 万维网的网站网盟推广平台
  • 网上做设计兼职哪个网站好点南京做网站的公司
  • 怎么做点击图片进网站西安网站搭建
  • 哪个网站可以做c 的项目免费seo网站推广
  • 网站建设 经验如何弄一个自己的网站
  • 如何自己做网站今日国际新闻头条
  • 网站的在线客服系统网站目录提交
  • 网站建设数据库实训体会网站提交收录
  • 网站后台都有哪些西安优化排名推广
  • 免费b2b网站发布信息营业推广
  • 全球最热门网站灯塔seo
  • 网站上的专题 怎么设计百度公司注册地址在哪里
  • php网站欣赏seo技术外包 乐云践新专家
  • 中山做网站哪个公司好西安seo盐城
  • 网站logo怎么做动态图网站托管服务商
  • 网站运营和seo的区别广告软文是什么意思