diff --git a/src/Configuration.h b/src/Configuration.h index ee072a9..673601d 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -132,8 +132,23 @@ namespace statusengine { Exchange = GetTomlDefault<>(tbl, "Exchange", std::string("statusengine")); - DurableExchange = GetTomlDefault<>(tbl, "DurableExchange", false); - DurableQueues = GetTomlDefault<>(tbl, "DurableQueues", false); + // Durable by default. A queue that is neither durable nor exclusive is + // RabbitMQ's deprecated transient_nonexcl_queues feature: 3.13 warns once per + // broker start, 4.x refuses the declare outright, and the broker then fails to + // connect at all (see Connect()). Durable has worked since AMQP 0-9-1, so it is + // the only value that works on every supported broker version. + // + // This does not put events on disk. Queue durability and message persistence + // are separate: durable stores the queue *definition*, while messages are only + // written durably when the publisher marks them persistent - and SendMessage + // passes properties=nullptr, i.e. transient. So the queues still buffer in RAM + // and a broker restart still empties them, which is the intended behaviour. + // + // The exchange follows the queues: a transient exchange loses its bindings on a + // broker restart while the durable queues survive, and keeping the pair + // consistent costs nothing, both being metadata only. + DurableExchange = GetTomlDefault<>(tbl, "DurableExchange", true); + DurableQueues = GetTomlDefault<>(tbl, "DurableQueues", true); SSL = GetTomlDefault<>(tbl, "SSL", false); diff --git a/statusengine.toml b/statusengine.toml index 7139368..0bf2b5a 100644 --- a/statusengine.toml +++ b/statusengine.toml @@ -45,8 +45,12 @@ WorkerCommand = "statusngin_cmd" ##Vhost = "/" ##Timeout = 30 ##Exchange = "statusengine" -##DurableExchange = false -##DurableQueues = false +## Durable queues and exchange. Required by RabbitMQ 4, which refuses to declare a queue +## that is neither durable nor exclusive. This stores queue and exchange *definitions* on +## disk, not the events: messages are published transient, so the queues still buffer in +## RAM and are still emptied by a broker restart. +##DurableExchange = true +##DurableQueues = true ##SSL = false ##SSL_verify = true ##SSL_cacert = ""