Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggested fix for "PRECONDITION_FAILED - invalid arg 'x-expires' for queue '...'… #48

Merged
merged 1 commit into from
Mar 15, 2019

Conversation

jarikp
Copy link
Contributor

@jarikp jarikp commented Mar 14, 2019

Hi,

Sorry, if you get a couple of other pull requests. My Git-client put wrong email adress into the commit and I was trying to correct that...

I get this error 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 proper unit tests for your project, but I have included some simple start up tests of the bus, that failed before this fix, and pass when the fix is included:
Message: Rebus.Injection.ResolutionException : Could not resolve Rebus.Bus.IBus with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler ----> Rebus.Exceptions.RebusApplicationException : Queue declaration for 'test_queue_1' failed ----> RabbitMQ.Client.Exceptions.OperationInterruptedException : The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - invalid arg 'x-expires' for queue 'test_queue_1' in vhost '/': {value_zero,0}", classId=50, methodId=10, cause=

Please let me know, if this is a correct solution, thank you!

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.

… in vhost '/': {value_zero,0}", classId=50, methodId=10, cause=" error happening when the bus was created using .InputQueueOptions() configurer and the for .SetAutoDelete(false) case (after upgrade to Rebus.RabbitMq v5.1.0.0)
@mookid8000 mookid8000 self-assigned this Mar 14, 2019
@mookid8000 mookid8000 merged commit a58c450 into rebus-org:master Mar 15, 2019
@ronnyek
Copy link
Contributor

ronnyek commented Mar 15, 2019

Apologies that I missed this stuff when originally committing this stuff. I could have sworn we did check for positive number.

@jarikp
Copy link
Contributor Author

jarikp commented Mar 17, 2019

No problem, it was an easy fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants