@@ -560,17 +560,17 @@ void ConsumerImpl::messageReceived(const ClientConnectionPtr& cnx, const proto::
560560 ? optional<EncryptionContext>(std::in_place, metadata, false )
561561 : std::nullopt ;
562562 const auto decryptionResult = decryptMessageIfNeeded (cnx, msg, encryptionContext, payload);
563- if (decryptionResult == FAILED) {
563+ if (decryptionResult == DecryptionResult:: FAILED) {
564564 // Message was discarded or not consumed due to decryption failure
565565 return ;
566- } else if (decryptionResult == CONSUME_ENCRYPTED && encryptionContext.has_value ()) {
566+ } else if (decryptionResult == DecryptionResult:: CONSUME_ENCRYPTED && encryptionContext.has_value ()) {
567567 // Message is encrypted, but we let the application consume it as-is
568- encryptionContext->isDecryptionFailed_ = true ;
568+ encryptionContext->setDecryptionFailed ( true ) ;
569569 }
570570
571571 auto redeliveryCount = msg.redelivery_count ();
572572 const bool isChunkedMessage = metadata.num_chunks_from_msg () > 1 ;
573- if (decryptionResult == SUCCESS && !isChunkedMessage) {
573+ if (decryptionResult == DecryptionResult:: SUCCESS && !isChunkedMessage) {
574574 if (!uncompressMessageIfNeeded (cnx, msg.message_id (), metadata, payload, true )) {
575575 // Message was discarded on decompression error
576576 return ;
@@ -615,7 +615,7 @@ void ConsumerImpl::messageReceived(const ClientConnectionPtr& cnx, const proto::
615615 return ;
616616 }
617617
618- if (metadata.has_num_messages_in_batch () && decryptionResult == SUCCESS) {
618+ if (metadata.has_num_messages_in_batch () && decryptionResult == DecryptionResult:: SUCCESS) {
619619 BitSet::Data words (msg.ack_set_size ());
620620 for (int i = 0 ; i < words.size (); i++) {
621621 words[i] = msg.ack_set (i);
@@ -821,14 +821,14 @@ auto ConsumerImpl::decryptMessageIfNeeded(const ClientConnectionPtr& cnx, const
821821 const optional<EncryptionContext>& context, SharedBuffer& payload)
822822 -> DecryptionResult {
823823 if (!context.has_value ()) {
824- return SUCCESS;
824+ return DecryptionResult:: SUCCESS;
825825 }
826826
827827 // If KeyReader is not configured throw exception based on config param
828828 if (!config_.isEncryptionEnabled ()) {
829829 if (config_.getCryptoFailureAction () == ConsumerCryptoFailureAction::CONSUME) {
830830 LOG_WARN (getName () << " CryptoKeyReader is not implemented. Consuming encrypted message." );
831- return CONSUME_ENCRYPTED;
831+ return DecryptionResult:: CONSUME_ENCRYPTED;
832832 } else if (config_.getCryptoFailureAction () == ConsumerCryptoFailureAction::DISCARD) {
833833 LOG_WARN (getName () << " Skipping decryption since CryptoKeyReader is not implemented and config "
834834 " is set to discard" );
@@ -839,20 +839,20 @@ auto ConsumerImpl::decryptMessageIfNeeded(const ClientConnectionPtr& cnx, const
839839 auto messageId = MessageIdBuilder::from (msg.message_id ()).build ();
840840 unAckedMessageTrackerPtr_->add (messageId);
841841 }
842- return FAILED;
842+ return DecryptionResult:: FAILED;
843843 }
844844
845845 SharedBuffer decryptedPayload;
846846 if (msgCrypto_->decrypt (*context, payload, config_.getCryptoKeyReader (), decryptedPayload)) {
847847 payload = decryptedPayload;
848- return SUCCESS;
848+ return DecryptionResult:: SUCCESS;
849849 }
850850
851851 if (config_.getCryptoFailureAction () == ConsumerCryptoFailureAction::CONSUME) {
852852 // Note, batch message will fail to consume even if config is set to consume
853853 LOG_WARN (
854854 getName () << " Decryption failed. Consuming encrypted message since config is set to consume." );
855- return CONSUME_ENCRYPTED;
855+ return DecryptionResult:: CONSUME_ENCRYPTED;
856856 } else if (config_.getCryptoFailureAction () == ConsumerCryptoFailureAction::DISCARD) {
857857 LOG_WARN (getName () << " Discarding message since decryption failed and config is set to discard" );
858858 discardCorruptedMessage (cnx, msg.message_id (), CommandAck_ValidationError_DecryptionError);
@@ -861,7 +861,7 @@ auto ConsumerImpl::decryptMessageIfNeeded(const ClientConnectionPtr& cnx, const
861861 auto messageId = MessageIdBuilder::from (msg.message_id ()).build ();
862862 unAckedMessageTrackerPtr_->add (messageId);
863863 }
864- return FAILED;
864+ return DecryptionResult:: FAILED;
865865}
866866
867867bool ConsumerImpl::uncompressMessageIfNeeded (const ClientConnectionPtr& cnx,
0 commit comments