vb.net - 重启后rabbitmq队列清空

标签 vb.net rabbitmq queue restart

我已经在 Windows Server 2012 64 位上安装了 RabbitMQ

我测试了具有大量数据的发布和消费部分,一切都很好,我面临的唯一问题是 RabbitMQServer 重新启动后队列中的消息丢失。

我正在使用RabbitMQ的VB.Net SDK。

我将 Queue Declare 的 “Durable” 属性设置为 true,并将 DeliveryMode BasicQueueProperties 设置为“2” 以使消息持久化。但在我的服务器重新启动后,消息仍然丢失。

我该如何克服这个问题?

最佳答案

https://www.rabbitmq.com/tutorials/tutorial-two-dotnet.html

在 RabbitMQ 上的消息持久性页面中,它解释得很好:

At this point we're sure that the task_queue queue won't be lost even if RabbitMQ restarts. Now we need to mark our messages as persistent - by setting IBasicProperties.Persistent to true.

var properties = channel.CreateBasicProperties();
properties.Persistent = true;
Note on message persistence

Marking messages as persistent doesn't fully guarantee that a message won't be lost. Although it tells RabbitMQ to save the message to disk, there is still a short time window when RabbitMQ has accepted a message and hasn't saved it yet. Also, RabbitMQ doesn't do fsync(2) for every message -- it may be just saved to cache and not really written to the disk. The persistence guarantees aren't strong, but it's more than enough for our simple task queue. If you need a stronger guarantee then you can use publisher confirms.

关于vb.net - 重启后rabbitmq队列清空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29520437/

相关文章:

VB.Net 密码哈希实践

include - Erlang:无法包含 header

java - 显示队列数组元素

JAVA 队列 - 单元测试失败

vb.net - 我如何在VB中的 ListView 控件中显示视频的图像缩略图?

.net - 按名称选择特定打印机 VB

.net - 前导 '.' 或 '! ' 只能出现在 'with' 语句内

python - Windows 上的 RabbitMQ 可移植?

c# - 与 AngularJS/.NET Web API 应用程序串联的 RabbitMQ 架构

sql - 编制SQL查询优先级队列表