suggested fix for "PRECONDITION_FAILED - invalid arg 'x-expires' for queue '....… #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I get this error in with the latest version of Rebus.RabbitMQ (5.1.0.0) from RabbitMq
"PRECONDITION_FAILED - invalid arg 'x-expires' for queue '…' in vhost '/': {value_zero,0}", classId=50, methodId=10, cause="
The error occurs when the bus is created using .InputQueueOptions() configurer, with SetAutoDelete(false). It seems that the config builder adds "x-expires" regardless of the auto-delete value, wich means "x-expires" has value 0 (the default of the ttlMs parameter) when auto-delete is false.
I suggest that "x-expires" is only included, if the autoDelete argument is true and the ttl is a positive number (exception otherwise, as before).
I was not sure how to fit a proper unit tests for your project, but I have included a very simple start up tests of the bus, that fail before this fix and pass when the fix is include.
Please let me know, if this is a correct solution.
Best regards
Jarik
Rebus is MIT-licensed. The code submitted in this pull request needs to carry the MIT license too. By leaving this text in, I hereby acknowledge that the code submitted in the pull request has the MIT license and can be merged with the Rebus codebase.