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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user