Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pulsar/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"log"
"net/http"
"os"
"regexp"
"strconv"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -1517,8 +1518,9 @@ func DLQWithProducerOptions(t *testing.T, prodOpt *ProducerOptions) {
expectMsg := fmt.Sprintf("hello-%d", expectedMsgIdx)
assert.Equal(t, []byte(expectMsg), msg.Payload())

// check dql produceName
assert.Equal(t, msg.ProducerName(), fmt.Sprintf("%s-%s-%s-DLQ", topic, sub, consumerName))
// check dlq produceName
regex := regexp.MustCompile(fmt.Sprintf("%s-%s-%s-[a-z]{5}-DLQ", topic, sub, consumerName))
assert.True(t, regex.MatchString(msg.ProducerName()))

// check original messageId
assert.NotEmpty(t, msg.Properties()[PropertyOriginMessageID])
Expand Down
2 changes: 1 addition & 1 deletion pulsar/dlq_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (r *dlqRouter) getProducer(schema Schema) Producer {
opt.Topic = r.policy.DeadLetterTopic
opt.Schema = schema
if opt.Name == "" {
opt.Name = fmt.Sprintf("%s-%s-%s-DLQ", r.topicName, r.subscriptionName, r.consumerName)
opt.Name = fmt.Sprintf("%s-%s-%s-%s-DLQ", r.topicName, r.subscriptionName, r.consumerName, generateRandomName())
}
opt.initialSubscriptionName = r.policy.InitialSubscriptionName

Expand Down
Loading