Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Fix retry topic subscription still sent by heartbeat
  • Loading branch information
zhangxu16 committed Mar 15, 2021
commit 5f3e3864217dc0be7a59d77d8f4da939b6737dd6
10 changes: 10 additions & 0 deletions consumer/push_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ func (pc *pushConsumer) Subscribe(topic string, selector MessageSelector,
return errors.New("cannot subscribe topic since client either failed to start or has been shutdown.")
}

// add retry topic subscription for resubscribe
retryTopic := internal.GetRetryTopic(pc.consumerGroup)
_, exists := pc.subscriptionDataTable.Load(retryTopic)
if !exists {
sub := buildSubscriptionData(retryTopic, MessageSelector{TAG, _SubAll})
pc.subscriptionDataTable.Store(retryTopic, sub)
}

if pc.option.Namespace != "" {
topic = pc.option.Namespace + "%" + topic
}
Expand All @@ -243,6 +251,8 @@ func (pc *pushConsumer) Subscribe(topic string, selector MessageSelector,

func (pc *pushConsumer) Unsubscribe(topic string) error {
pc.subscriptionDataTable.Delete(topic)
retryTopic := internal.GetRetryTopic(pc.consumerGroup)
pc.subscriptionDataTable.Delete(retryTopic)
return nil
}

Expand Down