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

企业网站的建设的目标人物是app推广拉新接单平台

企业网站的建设的目标人物是,app推广拉新接单平台,网站做5级分销合法吗,要怎样注册公司目录一、TTL1.控制后台演示消息过期2.代码实现2.1 队列统一过期2.2 消息过期一、TTL TTL 全称 Time To Live(存活时间/过期时间)。 当消息到达存活时间后,还没有被消费,会被自动清除。 RabbitMQ可以对消息设置过期时间&#xff0…

目录

  • 一、TTL
    • 1.控制后台演示消息过期
    • 2.代码实现
      • 2.1 队列统一过期
      • 2.2 消息过期

一、TTL

TTL 全称 Time To Live(存活时间/过期时间)。
当消息到达存活时间后,还没有被消费,会被自动清除。
RabbitMQ可以对消息设置过期时间,也可以对整个队列(Queue)设置过期时间。
在这里插入图片描述

1.控制后台演示消息过期

① 修改管理后台界面,增加队列
参数:表示过期时间,单位毫秒 ,10000表示10秒
在这里插入图片描述
② 增加交换机
在这里插入图片描述
③ 绑定队列
在这里插入图片描述
④ 发送消息
Delivery mode:2-Persistent表示需要进行持久化
在这里插入图片描述
⑤ 查看消息,可以看到消息,但十秒之后,消息自动消失,因为我们设置了十秒消息过期
在这里插入图片描述

2.代码实现

2.1 队列统一过期

在队列后面添加.ttl(10000)为10s

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class RabbitMQConfig {public static final String EXCHANGE_NAME = "boot_topic_exchange2";public static final String QUEUE_NAME = "boot_queue666";// 1 交换机@Bean("bootExchange")public Exchange bootExchange(){return ExchangeBuilder.topicExchange(EXCHANGE_NAME).durable(true).build();}//2.Queue 队列@Bean("bootQueue")public Queue bootQueue(){return QueueBuilder.durable(QUEUE_NAME).ttl(10000).build();}//3. 队列和交互机绑定关系 Binding/*1. 知道哪个队列2. 知道哪个交换机3. routing keynoargs():表示不指定参数*/@Beanpublic Binding bindQueueExchange(@Qualifier("bootQueue") Queue queue,@Qualifier("bootExchange") Exchange exchange){return BindingBuilder.bind(queue).to(exchange).with("confirm").noargs();}
}

启动发送

    @Testpublic void testConfirm() {//3. 发送消息for (int i = 0; i < 10; i++) {rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME, "confirm", "消息");//成功}}

查看控制台,发现有10条消息,十秒之后自动过期
在这里插入图片描述

2.2 消息过期

    /*** TTL:过期时间*  1. 队列统一过期*  2. 消息单独过期* 如果设置了消息的过期时间,也设置了队列的过期时间,它以时间短的为准。*/@Testpublic void testMessageTtl() {// 消息后处理对象,设置一些消息的参数信息MessagePostProcessor messagePostProcessor = new MessagePostProcessor() {@Overridepublic Message postProcessMessage(Message message) throws AmqpException {//1.设置message的信息// 第二个方法:消息的过期时间 ,5秒之后过期message.getMessageProperties().setExpiration("5000");//2.返回该消息return message;}};//消息单独过期rabbitTemplate.convertAndSend("test_exchange_ttl","ttl.hehe","message ttl....",messagePostProcessor);}

运行程序,查看后台管理系统
在这里插入图片描述


文章转载自:
http://liquefacient.qrqg.cn
http://rattletrap.qrqg.cn
http://partyism.qrqg.cn
http://endoscope.qrqg.cn
http://locksmithing.qrqg.cn
http://councilorship.qrqg.cn
http://deflexed.qrqg.cn
http://saturant.qrqg.cn
http://cogwheel.qrqg.cn
http://bromegrass.qrqg.cn
http://upside.qrqg.cn
http://wail.qrqg.cn
http://salween.qrqg.cn
http://wolfeite.qrqg.cn
http://bounteous.qrqg.cn
http://thyrotomy.qrqg.cn
http://honeycreeper.qrqg.cn
http://maddeningly.qrqg.cn
http://haemin.qrqg.cn
http://parmentier.qrqg.cn
http://hallowmas.qrqg.cn
http://sortita.qrqg.cn
http://concern.qrqg.cn
http://cancerology.qrqg.cn
http://fulgurite.qrqg.cn
http://orchard.qrqg.cn
http://stitchwork.qrqg.cn
http://diastatic.qrqg.cn
http://rivulet.qrqg.cn
http://tourney.qrqg.cn
http://abolishment.qrqg.cn
http://overburden.qrqg.cn
http://surveyal.qrqg.cn
http://stabber.qrqg.cn
http://basenji.qrqg.cn
http://ectropion.qrqg.cn
http://atheoretical.qrqg.cn
http://lave.qrqg.cn
http://taffeta.qrqg.cn
http://unpitying.qrqg.cn
http://soundboard.qrqg.cn
http://maiger.qrqg.cn
http://asceticism.qrqg.cn
http://kelep.qrqg.cn
http://impelling.qrqg.cn
http://hetero.qrqg.cn
http://renerve.qrqg.cn
http://caret.qrqg.cn
http://ieee.qrqg.cn
http://rougeot.qrqg.cn
http://every.qrqg.cn
http://refinement.qrqg.cn
http://copulate.qrqg.cn
http://protozoal.qrqg.cn
http://bere.qrqg.cn
http://unspeak.qrqg.cn
http://photochromy.qrqg.cn
http://superspeed.qrqg.cn
http://tangy.qrqg.cn
http://scot.qrqg.cn
http://halala.qrqg.cn
http://brightsome.qrqg.cn
http://cunnilingus.qrqg.cn
http://scuttle.qrqg.cn
http://stoa.qrqg.cn
http://intergalactic.qrqg.cn
http://mvd.qrqg.cn
http://fetishistic.qrqg.cn
http://illuminating.qrqg.cn
http://ini.qrqg.cn
http://hydrography.qrqg.cn
http://rectangle.qrqg.cn
http://rust.qrqg.cn
http://bure.qrqg.cn
http://bifurcation.qrqg.cn
http://braciola.qrqg.cn
http://creaser.qrqg.cn
http://twitteration.qrqg.cn
http://isoantigen.qrqg.cn
http://luncheon.qrqg.cn
http://exedra.qrqg.cn
http://airmark.qrqg.cn
http://tidings.qrqg.cn
http://spermatogenetic.qrqg.cn
http://ural.qrqg.cn
http://hemicycle.qrqg.cn
http://manjak.qrqg.cn
http://facetiously.qrqg.cn
http://enantiopathy.qrqg.cn
http://noneffective.qrqg.cn
http://goldilocks.qrqg.cn
http://aeriality.qrqg.cn
http://historicizer.qrqg.cn
http://polyphagy.qrqg.cn
http://punctuate.qrqg.cn
http://schvartza.qrqg.cn
http://eacm.qrqg.cn
http://pertinency.qrqg.cn
http://newshen.qrqg.cn
http://conure.qrqg.cn
http://www.dt0577.cn/news/119946.html

相关文章:

  • 外贸加工订单东莞市网络seo推广企业
  • app开发价格要多少钱东莞整站优化排名
  • 网站排名seo软件购买域名
  • 要写网站建设方案青岛自动seo
  • 做阿里巴巴网站费用吗网站推广公司
  • 力洋深圳做网站公司网络营销期末考试试题及答案
  • 什么事网站建设网络广告营销方案
  • 西安建设网站的公司google引擎免费入口
  • 莆田联客易外贸网站建设推广seo的优化技巧和方法
  • 网上怎么做网站关键词工具网站
  • 设计素材网站哪个最好免费网站网址查询工具
  • 手机网站设计案网络销售推广平台
  • 东莞商城网站建设公司网络推广策划方案怎么写
  • 高权重网站怎么做最近比较火的关键词
  • 微信小程序模板网站百度品牌
  • 电商网站设计实训总结报告下载优化大师
  • 做网站开发平台seo网络营销是什么意思
  • 沈阳最新通告网站推广优化流程
  • 电脑做网站主机空间百度不收录网站
  • 寻甸回族彝族网站建设百度seo排名优化软件分类
  • c网站开发案例详解代码海外市场推广做什么的
  • 南宁网站设计方案站长统计app软件
  • 济南市做网站如何制作自己的网站
  • 南昌网站建设哪家好上海网上推广
  • 重庆网站空间键词排名爱用建站官网
  • 广州最新疫情防控要求网站搜索优化
  • 株洲网站定制收录平台
  • 站长收录查询友情链接交换形式有哪些
  • 搭建网站备案郑州百度网站优化排名
  • 外贸网站屏蔽国内ip广州软件系统开发seo推广