-
-
Notifications
You must be signed in to change notification settings - Fork 46
Handle prefetchCount > max Short value #338
Copy link
Copy link
Open
Description
The AMQP spec says that prefetchCount is a short (16-bit) value. Despite this, the java amqp-client accents an int parameter. The int then has its MSB stripped off, and the remainder is reinterpreted as a short.
For example, if you supply a prefetch of 1_000_000, that gets interpreted as a prefetchCount of 16960
0b11110100001001000000 // 1_000_000
-----0b100001001000000 // 16_960
I have two proposals:
fs2-rabbit can change its ownIt's actually interpreted as an unsigned short, so we don't have an out of the box type for it.prefetchCountparameter ofBasicQosto be aShortinstead of anInt. Then invalid values simply can't be passed. Comments can direct the user about what to do- (binary compatible) fs2-rabbit can log an error when there's an attempt to
basicConsumewithprefetchCount > (2^16-1). We can also optionally "round" the requested count down to exactly (2^16-1)
Reactions are currently unavailable