You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2019/02/28 09:51:17 UTC

[rocketmq] branch snode updated: Send subscription to snode when using real push

This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch snode
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/snode by this push:
     new 66e15cf  Send subscription to snode when using real push
66e15cf is described below

commit 66e15cfa11531c8f09045ab5a2cf4c7a55aa3a50
Author: ShannonDing <li...@163.com>
AuthorDate: Thu Feb 28 17:50:52 2019 +0800

    Send subscription to snode when using real push
---
 .../consumer/DefaultMQRealPushConsumerImpl.java    | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQRealPushConsumerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQRealPushConsumerImpl.java
index 755ed58..e684dd1 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQRealPushConsumerImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQRealPushConsumerImpl.java
@@ -914,10 +914,14 @@ public class DefaultMQRealPushConsumerImpl implements MQPushConsumerInner {
                 topic, subExpression);
             this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
             if (this.mQClientFactory != null) {
-                this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                if (realPushModel) {
+                    this.mQClientFactory.sendHeartbeatToAllSnodeWithLock();
+                } else {
+                    this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                }
             }
         } catch (Exception e) {
-            throw new MQClientException("subscription exception", e);
+            throw new MQClientException("Subscription exception", e);
         }
     }
 
@@ -930,11 +934,15 @@ public class DefaultMQRealPushConsumerImpl implements MQPushConsumerInner {
             subscriptionData.setFilterClassSource(filterClassSource);
             this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
             if (this.mQClientFactory != null) {
-                this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                if (realPushModel) {
+                    this.mQClientFactory.sendHeartbeatToAllSnodeWithLock();
+                } else {
+                    this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                }
             }
 
         } catch (Exception e) {
-            throw new MQClientException("subscription exception", e);
+            throw new MQClientException("Subscription exception", e);
         }
     }
 
@@ -950,7 +958,11 @@ public class DefaultMQRealPushConsumerImpl implements MQPushConsumerInner {
 
             this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
             if (this.mQClientFactory != null) {
-                this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                if (realPushModel) {
+                    this.mQClientFactory.sendHeartbeatToAllSnodeWithLock();
+                } else {
+                    this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
+                }
             }
         } catch (Exception e) {
             throw new MQClientException("subscription exception", e);