未验证 提交 e277216b 编写于 作者: S sunxi92 提交者: GitHub

[ISSUE #2710] Delete unused parameters (#2692)

上级 9eae1d67
...@@ -432,8 +432,7 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner { ...@@ -432,8 +432,7 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner {
throw new IllegalArgumentException("Topic can not be null or empty."); throw new IllegalArgumentException("Topic can not be null or empty.");
} }
setSubscriptionType(SubscriptionType.SUBSCRIBE); setSubscriptionType(SubscriptionType.SUBSCRIBE);
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(defaultLitePullConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, subExpression);
topic, subExpression);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
this.defaultLitePullConsumer.setMessageQueueListener(new MessageQueueListenerImpl()); this.defaultLitePullConsumer.setMessageQueueListener(new MessageQueueListenerImpl());
assignedMessageQueue.setRebalanceImpl(this.rebalanceImpl); assignedMessageQueue.setRebalanceImpl(this.rebalanceImpl);
...@@ -749,8 +748,7 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner { ...@@ -749,8 +748,7 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner {
subscriptionData = rebalanceImpl.getSubscriptionInner().get(topic); subscriptionData = rebalanceImpl.getSubscriptionInner().get(topic);
} else { } else {
String topic = this.messageQueue.getTopic(); String topic = this.messageQueue.getTopic();
subscriptionData = FilterAPI.buildSubscriptionData(defaultLitePullConsumer.getConsumerGroup(), subscriptionData = FilterAPI.buildSubscriptionData(topic, SubscriptionData.SUB_ALL);
topic, SubscriptionData.SUB_ALL);
} }
PullResult pullResult = pull(messageQueue, subscriptionData, offset, defaultLitePullConsumer.getPullBatchSize()); PullResult pullResult = pull(messageQueue, subscriptionData, offset, defaultLitePullConsumer.getPullBatchSize());
......
...@@ -205,8 +205,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner { ...@@ -205,8 +205,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
} }
try { try {
return FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), return FilterAPI.buildSubscriptionData(mq.getTopic(), subExpression);
mq.getTopic(), subExpression);
} catch (Exception e) { } catch (Exception e) {
throw new MQClientException("parse subscription error", e); throw new MQClientException("parse subscription error", e);
} }
...@@ -301,8 +300,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner { ...@@ -301,8 +300,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
public void subscriptionAutomatically(final String topic) { public void subscriptionAutomatically(final String topic) {
if (!this.rebalanceImpl.getSubscriptionInner().containsKey(topic)) { if (!this.rebalanceImpl.getSubscriptionInner().containsKey(topic)) {
try { try {
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, SubscriptionData.SUB_ALL);
topic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.subscriptionInner.putIfAbsent(topic, subscriptionData); this.rebalanceImpl.subscriptionInner.putIfAbsent(topic, subscriptionData);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
...@@ -365,7 +363,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner { ...@@ -365,7 +363,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
for (String t : topics) { for (String t : topics) {
SubscriptionData ms = null; SubscriptionData ms = null;
try { try {
ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); ms = FilterAPI.buildSubscriptionData(t, SubscriptionData.SUB_ALL);
} catch (Exception e) { } catch (Exception e) {
log.error("parse subscription error", e); log.error("parse subscription error", e);
} }
...@@ -742,8 +740,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner { ...@@ -742,8 +740,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
Set<String> registerTopics = this.defaultMQPullConsumer.getRegisterTopics(); Set<String> registerTopics = this.defaultMQPullConsumer.getRegisterTopics();
if (registerTopics != null) { if (registerTopics != null) {
for (final String topic : registerTopics) { for (final String topic : registerTopics) {
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, SubscriptionData.SUB_ALL);
topic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
} }
} }
......
...@@ -827,8 +827,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner { ...@@ -827,8 +827,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
for (final Map.Entry<String, String> entry : sub.entrySet()) { for (final Map.Entry<String, String> entry : sub.entrySet()) {
final String topic = entry.getKey(); final String topic = entry.getKey();
final String subString = entry.getValue(); final String subString = entry.getValue();
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, subString);
topic, subString);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
} }
} }
...@@ -842,8 +841,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner { ...@@ -842,8 +841,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
break; break;
case CLUSTERING: case CLUSTERING:
final String retryTopic = MixAll.getRetryTopic(this.defaultMQPushConsumer.getConsumerGroup()); final String retryTopic = MixAll.getRetryTopic(this.defaultMQPushConsumer.getConsumerGroup());
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(retryTopic, SubscriptionData.SUB_ALL);
retryTopic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.getSubscriptionInner().put(retryTopic, subscriptionData); this.rebalanceImpl.getSubscriptionInner().put(retryTopic, subscriptionData);
break; break;
default: default:
...@@ -874,8 +872,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner { ...@@ -874,8 +872,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
public void subscribe(String topic, String subExpression) throws MQClientException { public void subscribe(String topic, String subExpression) throws MQClientException {
try { try {
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, subExpression);
topic, subExpression);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
if (this.mQClientFactory != null) { if (this.mQClientFactory != null) {
this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
...@@ -887,8 +884,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner { ...@@ -887,8 +884,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException {
try { try {
SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(topic, "*");
topic, "*");
subscriptionData.setSubString(fullClassName); subscriptionData.setSubString(fullClassName);
subscriptionData.setClassFilterMode(true); subscriptionData.setClassFilterMode(true);
subscriptionData.setFilterClassSource(filterClassSource); subscriptionData.setFilterClassSource(filterClassSource);
......
...@@ -36,8 +36,7 @@ public class FilterAPI { ...@@ -36,8 +36,7 @@ public class FilterAPI {
return simple; return simple;
} }
public static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic, public static SubscriptionData buildSubscriptionData(String topic, String subString) throws Exception {
String subString) throws Exception {
SubscriptionData subscriptionData = new SubscriptionData(); SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.setTopic(topic); subscriptionData.setTopic(topic);
subscriptionData.setSubString(subString); subscriptionData.setSubString(subString);
...@@ -67,7 +66,7 @@ public class FilterAPI { ...@@ -67,7 +66,7 @@ public class FilterAPI {
public static SubscriptionData build(final String topic, final String subString, public static SubscriptionData build(final String topic, final String subString,
final String type) throws Exception { final String type) throws Exception {
if (ExpressionType.TAG.equals(type) || type == null) { if (ExpressionType.TAG.equals(type) || type == null) {
return buildSubscriptionData(null, topic, subString); return buildSubscriptionData(topic, subString);
} }
if (subString == null || subString.length() < 1) { if (subString == null || subString.length() < 1) {
......
...@@ -33,7 +33,7 @@ public class FilterAPITest { ...@@ -33,7 +33,7 @@ public class FilterAPITest {
@Test @Test
public void testBuildSubscriptionData() throws Exception { public void testBuildSubscriptionData() throws Exception {
SubscriptionData subscriptionData = SubscriptionData subscriptionData =
FilterAPI.buildSubscriptionData(group, topic, subString); FilterAPI.buildSubscriptionData(topic, subString);
assertThat(subscriptionData.getTopic()).isEqualTo(topic); assertThat(subscriptionData.getTopic()).isEqualTo(topic);
assertThat(subscriptionData.getSubString()).isEqualTo(subString); assertThat(subscriptionData.getSubString()).isEqualTo(subString);
String[] tags = subString.split("\\|\\|"); String[] tags = subString.split("\\|\\|");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册