Azure / go-amqp

AMQP 1.0 client library for Go.
https://github.com/Azure/go-amqp
MIT License
110 stars 58 forks source link

Default message priority should be 4, not 0 #313

Open mkuratczyk opened 11 months ago

mkuratczyk commented 11 months ago

According to the specification, the default priority should be 4: https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header It's also mentioned in a comment: https://github.com/Azure/go-amqp/blob/main/message.go#L306

However, currently, it is implicitly set to 0, since that's the default for uint8. For example, I believe this test should pass after removing Priority: 4 but it fails.

Similar issue in AMQP.Net Lite from a few years ago: https://github.com/Azure/amqpnetlite/issues/301

jhendrixMSFT commented 2 months ago

Sorry for the delay.

Unfortunately, the zero-value for Priority is ambiguous. So, when it's 0 it's interpreted verbatim.

Ideally, this field would be pointer-to-type so when it's nil that means 4. That would be a breaking change at this point though.

I see two options.