This is an automated email from the ASF dual-hosted git repository. cserwen pushed a commit to branch push_consumer_opti_apache in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git
commit 8cd983d2e225750fdb3caa8a77281a42bee792a7 Author: dengzhiwen1 <[email protected]> AuthorDate: Fri Jun 24 11:26:08 2022 +0800 add some method for pushConsumer --- 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 4ad5ee3..37b1f4a 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() }
