Skip to content

Handle more failure types in the rabbitmqqueue:declare/6 when declaring a stream (backport #11742) #11777

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

Merged
merged 3 commits into from
Jul 22, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jul 22, 2024

The rabbitmqqueue:declare is handled, and in case of known errors, the correct error code is sent back.

Proposed Changes

In case a queue is created with the wrong parameters, like:

management.queue().name("stream").type(STREAM).deadLetterExchange("aaaa").declare();

The server raised:

2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0> ** Reason for termination ==
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0> ** {{amqp_error,precondition_failed,
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0>                 "invalid arg 'x-dead-letter-exchange' for queue 'stream' in vhost '/' of queue type rabbit_stream_queue",
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0>                 none},
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0>     [{rabbit_misc,protocol_error,1,[{file,"rabbit_misc.erl"},{line,291}]},
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0>      {lists,foreach_1,2,[{file,"lists.erl"},{line,1686}]},
2024-07-18 09:10:03 2024-07-18 07:10:03.875080+00:00 [error] <0.98045.0>      {rabbit_amqqueue,declare,7,

because the rabbit_amqqueue:declare could go in error.

With this PR the error is handled like other cases

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

To reproduce the issue is enough to:

management.queue().name("stream").type(STREAM).deadLetterExchange("aaaa").declare();

With this fix the call returns:

Exception in thread "main" com.rabbitmq.client.amqp.AmqpException: Unexpected response code: 400 instead of 204

that is correct


This is an automatic backport of pull request #11742 done by [Mergify](https://mergify.com).

Gsantomaggio and others added 3 commits July 22, 2024 10:51
The rabbitmqqueue:declare is handled, and in case of known errors, the correct error code is sent back.

Signed-off-by: Gabriele Santomaggio <[email protected]>
(cherry picked from commit 93946ee)
Signed-off-by: Gabriele Santomaggio <[email protected]>
(cherry picked from commit f970753)
and remove inner case statement since we only want
rabbit_amqqueue:declare/6 to be protected.

(cherry picked from commit 909f0d8)
@michaelklishin michaelklishin added this to the 4.0.0 milestone Jul 22, 2024
@michaelklishin michaelklishin merged commit df61faa into v4.0.x Jul 22, 2024
191 checks passed
@michaelklishin michaelklishin deleted the mergify/bp/v4.0.x/pr-11742 branch July 22, 2024 12:57
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