This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new ad827de add some method for pushConsumer (#849)
ad827de is described below
commit ad827debf40202ef9ec6e0b6691aa05513c3dbbf
Author: cserwen <[email protected]>
AuthorDate: Thu Jul 21 23:45:50 2022 +0800
add some method for pushConsumer (#849)
Co-authored-by: dengzhiwen1 <[email protected]>
---
api.go | 6 ++++++
consumer/push_consumer.go | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/api.go b/api.go
index 8d6d781..4dd05aa 100644
--- a/api.go
+++ b/api.go
@@ -65,6 +65,12 @@ type PushConsumer interface {
// Unsubscribe a topic
Unsubscribe(topic string) error
+
+ // Suspend the consumption
+ Suspend()
+
+ // Resume the consumption
+ Resume()
}
func NewPushConsumer(opts ...consumer.Option) (PushConsumer, error) {
diff --git a/consumer/push_consumer.go b/consumer/push_consumer.go
index 47fe679..be2cf61 100644
--- a/consumer/push_consumer.go
+++ b/consumer/push_consumer.go
@@ -255,6 +255,14 @@ func (pc *pushConsumer) Unsubscribe(topic string) error {
return nil
}
+func (pc *pushConsumer) Suspend() {
+ pc.suspend()
+}
+
+func (pc *pushConsumer) Resume() {
+ pc.resume()
+}
+
func (pc *pushConsumer) Rebalance() {
pc.defaultConsumer.doBalance()
}