fix(fifo): ContentBasedDeduplication + dedup window survives delete (AWS semantics)

- ContentBasedDeduplication=true: dedupId computed from body SHA-256 when not provided
- do NOT drop dedupId on message delete: AWS keeps the 5-minute window regardless
  (previously re-send after delete delivered the message again)
- utils: GetSHA256Hash
This commit is contained in:
Repinoid
2026-10-10 17:30:02 +03:00
parent 9f1242aca3
commit ccd070200a
5 changed files with 30 additions and 7 deletions
+8
View File
@@ -2,6 +2,7 @@ package utils
import (
"crypto/md5"
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"encoding/hex"
@@ -97,6 +98,13 @@ func GetMD5Hash(text string) string {
return hex.EncodeToString(hasher.Sum(nil))
}
// GetSHA256Hash — SHA-256 (hex) от значения. Используется для
// ContentBasedDeduplication: AWS сам вычисляет MessageDeduplicationId из тела.
func GetSHA256Hash(text string) string {
sum := sha256.Sum256([]byte(text))
return hex.EncodeToString(sum[:])
}
func HashAttributes(attributes map[string]models.MessageAttribute) string {
hasher := md5.New()