-
Notifications
You must be signed in to change notification settings - Fork 61
Description
When durable=false, the durable field is omitted in
Line 331 in 1003610
| {Value: &h.Durable, Omit: !h.Durable}, |
This complies with the spec given that the spec defaults to false for durable.
However, the spec also mentions:
The header section carries standard delivery details about the transfer of a message through the AMQP network. If the header section is omitted the receiver MUST assume the appropriate default values (or the meaning implied by no value being set) for the fields within the header unless other target or node specific defaults have otherwise been set.
This means that brokers could set other defaults.
RabbitMQ 4.0 interprets durable as true by default to be safe by default.
Beginners could easily forget setting the durable field to true resulting in unexpected message loss. This applies to all brokers, not only RabbitMQ.
Hence, I suggest that this client lib should explicitly send the durable field when the user sets this field to false to allow RabbitMQ to store the message non-durable (if explicitly requested by the user).
In other words, do not omit this field when marshalling.
You could use pointers to differentiate between field is set vs field is unset.
The performance penalty of sending this field is negligible.