1、RabbitMQ的消息持久化处理,消息的可靠性是 RabbitMQ 的一大特色,那么 RabbitMQ 是如何保证消息可靠性的呢——消息持久化。

2、autoDelete属性的理解。

  1)、@Queue: 当autoDelete属性设置到该注解的时候,含义即是,当所有消费者客户端连接断开后,是否自动删除队列,当设置值是true的时候删除该队列,当值是false的时候不删除该队列。

  2)、@Exchange:当autoDelete属性设置到该注解的时候,含义即是,当所有绑定队列都不在使用时,是否自动删除交换器,当设置值是true的时候删除该交换器,当值是false的时候不删除该交换器。

3、之前写过RabbitMQ的交换器Exchange之direct(发布与订阅 完全匹配),这里借助这个进行消息持久化测试。生产者的代码不发生改变,这里只是将消费者的autoDelete = "true"属性修改为autoDelete = "false",进行对比测试。

Info级别的日志进行消息的持久化操作,即队列不进行自动删除。将autoDelete = "false"即可。

 package com.example.bie.consumer;

 import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component; /**
*
* @author biehl
*
* 消息接收者
*
* 1、@RabbitListener bindings:绑定队列
*
* 2、@QueueBinding
* value:绑定队列的名称、exchange:配置交换器、key:路由键routing-key绑定队列和交换器
*
* 3、@Queue value:配置队列名称、autoDelete:是否是一个可删除的临时队列
*
* 4、@Exchange value:为交换器起个名称、type:指定具体的交换器类型
*
*
*/
@Component
@RabbitListener(bindings = @QueueBinding( value = @Queue(value = "${rabbitmq.config.queue.info}", autoDelete = "false"), exchange = @Exchange(value = "${rabbitmq.config.exchange}", type = ExchangeTypes.DIRECT), key = "${rabbitmq.config.queue.info.routing.key}"))
public class LogInfoConsumer { /**
* 接收消息的方法,采用消息队列监听机制.
*
* @RabbitHandler意思是将注解@RabbitListener配置到类上面
*
* @RabbitHandler是指定这个方法可以进行消息的接收并且消费.
*
* @param msg
*/
@RabbitHandler
public void consumer(String msg) {
// 打印消息
System.out.println("INFO消费者===>消费: " + msg);
} }

Error级别的日志进行消息的持久化操作,即队列进行自动删除。将autoDelete = "true"即可。

 package com.example.bie.consumer;

 import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component; /**
*
* @author biehl
*
* 消息接收者
*
* 1、@RabbitListener bindings:绑定队列
*
* 2、@QueueBinding
* value:绑定队列的名称、exchange:配置交换器、key:路由键routing-key绑定队列和交换器
*
* 3、@Queue value:配置队列名称、autoDelete:是否是一个可删除的临时队列
*
* 4、@Exchange value:为交换器起个名称、type:指定具体的交换器类型
*
*
*/
@Component
@RabbitListener(bindings = @QueueBinding( value = @Queue(value = "${rabbitmq.config.queue.error}", autoDelete = "true"), exchange = @Exchange(value = "${rabbitmq.config.exchange}", type = ExchangeTypes.DIRECT), key = "${rabbitmq.config.queue.error.routing.key}"))
public class LogErrorConsumer { /**
* 接收消息的方法,采用消息队列监听机制.
*
* @RabbitHandler意思是将注解@RabbitListener配置到类上面
*
* @RabbitHandler是指定这个方法可以进行消息的接收并且消费.
*
* @param msg
*/
@RabbitHandler
public void consumer(String msg) {
// 打印消息
System.out.println("ERROR消费者===>消费<===消息message: " + msg);
} }

4、启动你的生产者,启动你的消费者,观察RabbitMQ的图形化界面。未生产消息、未消费消息的界面如下所示:

生产消息、消费消息的界面如下所示,我这里还使用浏览器访问控制层触发生产者生产消息,消费者消费消息:

现在停止你的消费者,记录消息到第几条消息了。方便再次启动消费者进行观察。

启动你的消费者,观察,看看是从第几条开始消费的。可以看到消息从第82条开始消费的。

  RabbitMQ的消息持久化处理,Ready是对未接收到的数据状态表示,如果RabbitMQ在队列里面存放的消息未被消费者所消费,那么会给未消费的消息加一个标记,表示当前这个消息未被消费。消息持久化处理解决了丢失消息的这种状况,我们可以接收到消息,就是因为队列一直存在着呢,但是手动删除队列,消息也就丢失了,所以要慎重操作。当消费者停止以后,生产者生产的消息存储在RabbitMQ的服务器内存中,队列也存在内存中,数据在队列中,即数据保存在内存中。但是如果RabbitMQ的服务都停止了,队列也就消失了,队列消失了,数据也就丢失了。

aaarticlea/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAFYAVgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9U6KKKACiiigA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xX8rBGDX9UxXOKUAgAZoAWv5V/Sv6p8gV/KzigD+qbOMV/KwRg1/VMRn8KBwAM0AfysgZNf1Tg5pDyCM0AbTQApIHWgHIpCMmv5Wsj0oAQDJr+qfI69qQ8gjNJtx3oAdmv5WOlPBAzX9Ui9OtAH8rFf1TnvX8rFf1TkZoA/lZ9a/qm601gc1/K2evSgBK/qnPev5WK/qnPegD+Vg9aKD1ooAAMmv6pwc0EEgjNIBtNACkgdaAcimtye9fytnr0oA/qnr+Vfriv6p81/K1jFADcUEYNf1SnPX9K/lbI56flQB/VPRRRQAUUUUAFFFFACd6/lYr+qfvX8rFAH9U55oAxX8rFFAH9U+PYUY9hX8rFFAH9U5JAzjNfyskYwfekBwaMkmgD+qcdKWkHSloA/lXzS7iaSigAzRmiigAzSjmko6UAf1S5I96/lbIHrSZr+qfpQB/KwOT1p2Mc579KaDiv6pwBQA0mnL0HGKMDp2r+VgnJoAUAetf1ShiT0petfysGgD+qZjzjFKBx0r+VgGv6pwMUAfysAZNf1S7uSMV/K0Dg0ZyaAHbe+aaRg1/VNjOK/lZJzQB/VPQc4r+ViigB+OO2K/qjHI6fnX8rOT60E5NACjr1r+qQHnvTiMijAAoATGetKBjtX8rB60UAf1UUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAf//Z" alt="" />

作者:别先生

博客园:https://www.cnblogs.com/biehongli/

如果您想及时得到个人撰写文章以及著作的消息推送,可以扫描上方二维码,关注个人公众号哦。

RabbitMQ的消息持久化处理的更多相关文章

  1. RabbitMQ(三):消息持久化策略

    原文:RabbitMQ(三):消息持久化策略 一.前言 在正常的服务器运行过程中,时常会面临服务器宕机重启的情况,那么我们的消息此时会如何呢?很不幸的事情就是,我们的消息可能会消失,这肯定不是我们希望 ...

  2. 【python】-- RabbitMQ 队列消息持久化、消息公平分发

    RabbitMQ 队列消息持久化 假如消息队列test里面还有消息等待消费者(consumers)去接收,但是这个时候服务器端宕机了,这个时候消息是否还在? 1.队列消息非持久化 服务端(produc ...

  3. RabbitMQ 的消息持久化与 Spring AMQP 的实现剖析

    文章目录 1. 原生的实现方式 2. Spring AMQP 的实现方式   要从奔溃的 RabbitMQ 中恢复的消息,我们需要做消息持久化.如果消息要从 RabbitMQ 奔溃中恢复,那么必须满足 ...

  4. RabbitMQ之消息持久化(转)

    原文地址 https://blog.csdn.net/u013256816/article/details/60875666/ 消息的可靠性是RabbitMQ的一大特色,那么RabbitMQ是如何保证 ...

  5. RabbitMq初探——消息持久化

    消息持久化 前言 通过上一节,我们知道,有消息确认机制,保证了当消费者进程挂掉后,消息的不丢失. 但是如果rabbitmq挂掉呢?它的队列和消息都会丢失的.为了保证消息在rabbitmq挂掉重启后不丢 ...

  6. RabbitMQ之消息持久化

    消息的可靠性是RabbitMQ的一大特色,那么RabbitMQ是如何保证消息可靠性的呢——消息持久化. 为了保证RabbitMQ在退出或者crash等异常情况下数据没有丢失,需要将queue,exch ...

  7. RabbitMQ之消息持久化(队列持久化、消息持久化)

    rabbitMQ不支持数据库的持久化,只支持内存以及文件持久化 https://blog.csdn.net/bwh0520/article/details/78746873 http://blog.y ...

  8. RabbitMQ入门_13_消息持久化

    参考资料:https://www.rabbitmq.com/tutorials/tutorial-two-java.html 默认情况下,队列中的消息是不持久化的.如果 RabbitMQ 崩溃,队列中 ...

  9. RabbitMQ防止消息丢失

    转载请注明出处 0.目录 RabbitMQ-从基础到实战(1)— Hello RabbitMQ RabbitMQ-从基础到实战(3)— 消息的交换 1.简介 RabbitMQ中,消息丢失可以简单的分为 ...

随机推荐

  1. Educational Codeforces Round 77 (Rated for Div. 2) D A game with traps

    题意:x正轴上有着一个陷阱的位置,开关和灵敏度,如果一个士兵灵敏度输给陷阱,他是过不去这个陷阱的幸运的是,你可以先过去把开关给关了,没错你是不怕陷阱的接下来呢你有操作,你移动一个,耗费一秒而你的团队需 ...

  2. 上手OrangePi Zero+

    一.安装系统 所需材料:系统镜像文件.镜像烧录工具.至少2G的内存卡(推荐8G以上).读卡器 1.下载系统镜像 官方系统下载地址,由于官方系统更新截止到17年,所以我选择的是Armbian系统.下载地 ...

  3. MyBatis PropertyTokenizer

    PropertyTokenizer package org.apache.ibatis.reflection.property; import java.util.Iterator; /* 例1: 参 ...

  4. 查看Linux服务器CPU总核数

    下面介绍查看Linux服务器CPU总核数的方法. 通过/proc/cpuinfo可查看CPU个数及总核数. [root@kevin ~]# grep processor /proc/cpuinfo | ...

  5. 阿里面试实战题2----ReentrantLock里面lock和tryLock的区别

    ReentrantLock ReentrantLock(轻量级锁)也可以叫对象锁,可重入锁,互斥锁.synchronized重量级锁,JDK前期的版本lock比synchronized更快,在JDK1 ...

  6. 数据显示按规格向datatable中增加空白记录

    /// <summary> /// 按前台分页样式为datatable增加空行 /// </summary> /// <param name="gridPage ...

  7. 清新简约风格毕业论文答辩PPT模板推荐

    不管是学生还是老师,应该经常会需要学生答辩的PPT模板,今天给大家推荐织梦58的学生答辩ppt模板. 模版来源:http://ppt.dede58.com/gongzuohuibao/26494.ht ...

  8. flutter 打包apk

    打包的具体操作,可以参照官网,只是官网没有那么细 1.修改AndroidManifest.xml 2.构建配置  可以跳过 3.构建签名 4.创建 key.properties 5.配置混淆 6.修改 ...

  9. React Native适配IPhoneX系列设备之<SafeAreaView />

    SafeAreaView的目的是在一个“安全”的可视区域内渲染内容.具体来说就是因为目前有 iPhone X 这样的带有“刘海”的全面屏设备,所以需要避免内容渲染到不可见的“刘海”范围内.本组件目前仅 ...

  10. JS 对象定义

    JS 对象 JavaScript 中的所有事物都是对象:字符串.数值.数组.函数... 此外,JavaScript 允许自定义对象. JavaScript 对象 JavaScript 提供多个内建对象 ...