MSMQ - 读取后是否从 mq 文件中删除了消息?

MSMQ - are messages deleted from the mq files once read?

是否可以从已处理和删除的持久性 mq 文件(例如 p000001.mq)中读取队列消息,或者消息是否会立即删除?

删除消息时mq文件没有缩小,但是我在QueueExplorer中好像打不开。

"Is it possible to read a queue message from a persistent mq file that has been processed and deleted."
否。如果您在记事本中打开该文件,那么您应该能够看到消息数据仍然存在,但会设置一个标志,以便 MSMQ 知道使消息不可见。

MQ 文件不会立即收缩,因为这会影响磁盘 I/O 性能。 MSMQ 在两点执行文件清理:

  • 服务启动
  • 在 MessageCleanupInterval(默认 6 小时)之后。