From cbc09de5a24e9e8ebb95be4b725b999cb20691fe Mon Sep 17 00:00:00 2001 From: Freddie Lamble Date: Thu, 3 Dec 2026 06:03:30 +0000 Subject: [PATCH] Clean up deprecated ConsumerAck enums f9c885b marked `ConsumerAck::REJECT` and `REQUEUE` as deprecated, as they were replaced with clearer names. These can now be cleaned up, along with the tests that were only there to ensure a smooth transition. --- src/rmq/rmqt/rmqt_consumerack.cpp | 6 ------ src/rmq/rmqt/rmqt_consumerack.h | 14 ++------------ src/tests/rmqt/rmqt_consumerack.t.cpp | 27 --------------------------- 3 files changed, 2 insertions(+), 45 deletions(-) diff --git a/src/rmq/rmqt/rmqt_consumerack.cpp b/src/rmq/rmqt/rmqt_consumerack.cpp index c1d3ed29..39c44389 100644 --- a/src/rmq/rmqt/rmqt_consumerack.cpp +++ b/src/rmq/rmqt/rmqt_consumerack.cpp @@ -17,15 +17,9 @@ #include -#include - namespace BloombergLP { namespace rmqt { -// Until REJECT and REQUEUE can be retired -BSLMF_ASSERT(ConsumerAck::REJECT == ConsumerAck::NACK_REQUEUE_FALSE); -BSLMF_ASSERT(ConsumerAck::REQUEUE == ConsumerAck::NACK_REQUEUE_TRUE); - ConsumerAck::ConsumerAck(const Envelope& envelope, Type type) : d_envelope(envelope) , d_type(type) diff --git a/src/rmq/rmqt/rmqt_consumerack.h b/src/rmq/rmqt/rmqt_consumerack.h index f53ed39f..79b39295 100644 --- a/src/rmq/rmqt/rmqt_consumerack.h +++ b/src/rmq/rmqt/rmqt_consumerack.h @@ -46,16 +46,7 @@ class ConsumerAck { /// `basic.reject` with requeue=false REJECT_REQUEUE_FALSE = 3, /// `basic.reject` with requeue=true - REJECT_REQUEUE_TRUE = 4, - - /// \deprecated Use `NACK_REQUEUE_FALSE`. This name predates support - /// for `basic.reject` and is misleading: it sends - /// `basic.nack`, so the delivery is not counted as a - /// failed attempt. - REJECT = NACK_REQUEUE_FALSE, - /// \deprecated Use `NACK_REQUEUE_TRUE`. This name predates support - /// for `basic.reject`. - REQUEUE = NACK_REQUEUE_TRUE + REJECT_REQUEUE_TRUE = 4 }; ConsumerAck(const Envelope& envelope, Type type); @@ -65,8 +56,7 @@ class ConsumerAck { Type type() const { return d_type; } /// RETURN `true` if `type` sends `basic.reject` rather than - /// `basic.nack`. Note this is `false` for the deprecated `REJECT`, which - /// sends `basic.nack`. + /// `basic.nack`. static bool usesBasicReject(Type type); /// RETURN `true` if the AMQP method that `type` sends carries a diff --git a/src/tests/rmqt/rmqt_consumerack.t.cpp b/src/tests/rmqt/rmqt_consumerack.t.cpp index 883ac753..755e1885 100644 --- a/src/tests/rmqt/rmqt_consumerack.t.cpp +++ b/src/tests/rmqt/rmqt_consumerack.t.cpp @@ -37,26 +37,6 @@ bsl::string toString(rmqt::ConsumerAck::Type type) } // namespace -// The values are the stable part of this enum: they go in no wire frame, but -// the deprecated aliases only remain compatible while they keep the value -// their old name had. -TEST(ConsumerAckTests, ValuesAreFixed) -{ - EXPECT_EQ(rmqt::ConsumerAck::ACK, 0); - EXPECT_EQ(rmqt::ConsumerAck::NACK_REQUEUE_FALSE, 1); - EXPECT_EQ(rmqt::ConsumerAck::NACK_REQUEUE_TRUE, 2); - EXPECT_EQ(rmqt::ConsumerAck::REJECT_REQUEUE_FALSE, 3); - EXPECT_EQ(rmqt::ConsumerAck::REJECT_REQUEUE_TRUE, 4); -} - -// REJECT and REQUEUE predate support for basic.reject and both send -// basic.nack. They have to keep meaning exactly what they meant before. -TEST(ConsumerAckTests, DeprecatedAliasesAreUnchanged) -{ - EXPECT_EQ(rmqt::ConsumerAck::REJECT, rmqt::ConsumerAck::NACK_REQUEUE_FALSE); - EXPECT_EQ(rmqt::ConsumerAck::REQUEUE, rmqt::ConsumerAck::NACK_REQUEUE_TRUE); -} - TEST(ConsumerAckTests, UsesBasicReject) { EXPECT_FALSE(rmqt::ConsumerAck::usesBasicReject(rmqt::ConsumerAck::ACK)); @@ -70,13 +50,6 @@ TEST(ConsumerAckTests, UsesBasicReject) rmqt::ConsumerAck::REJECT_REQUEUE_TRUE)); } -// The deprecated REJECT sends basic.nack, so it must not be reported as a -// basic.reject however much its name suggests otherwise. -TEST(ConsumerAckTests, DeprecatedRejectDoesNotUseBasicReject) -{ - EXPECT_FALSE(rmqt::ConsumerAck::usesBasicReject(rmqt::ConsumerAck::REJECT)); -} - // basic.ack and basic.nack carry a `multiple` flag, basic.reject does not. // Batching a reject would resolve only the highest delivery tag in the batch // and silently leave the rest outstanding.