GPrabhudas commented on a change in pull request #612:
URL: https://github.com/apache/pulsar-client-go/pull/612#discussion_r704068602



##########
File path: pulsar/consumer_partition.go
##########
@@ -479,7 +505,49 @@ func (pc *partitionConsumer) MessageReceived(response 
*pb.CommandMessage, header
                return err
        }
 
-       uncompressedHeadersAndPayload, err := pc.Decompress(msgMeta, 
headersAndPayload)
+       decryptedPayload, err := 
pc.decryptor.Decrypt(headersAndPayload.ReadableSlice(), pbMsgID, msgMeta)
+       messages := make([]*message, 0)
+
+       // error decrypting the payload
+       if err != nil {
+               pc.log.Error(err)
+               switch pc.decryptor.CryptoFailureAction() {
+               case crypto.ConsumerCryptoFailureActionFail:
+                       pc.log.Errorf("consuming message failed due to 
decryption err :%v", err)
+                       return err
+               case crypto.ConsumerCryptoFailureActionDiscard:
+                       pc.discardCorruptedMessage(pbMsgID, 
pb.CommandAck_DecryptionError)
+                       return fmt.Errorf("discarding message on decryption 
error :%v", err)
+               case crypto.ConsumerCryptoFailureActionConsume:
+                       pc.log.Warnf("consuming encrypted message due to error 
in decryption :%v", err)
+                       messages = append(messages, &message{
+                               publishTime:  
timeFromUnixTimestampMillis(msgMeta.GetPublishTime()),

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to