Skip to content

Commit 7660171

Browse files
committed
update tag
1 parent 7fc0833 commit 7660171

8 files changed

Lines changed: 32 additions & 85 deletions

File tree

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/annotation/ExtConsumerResetConfiguration.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
/**
5656
* Tag of consumer. Used for message filtering.
57-
* For TAG selectorType, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
58-
* For SQL92 selectorType, use SQL92 expression like "a > 5 AND b < 10".
57+
* For TAG filterExpressionType, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
58+
* For SQL92 filterExpressionType, use SQL92 expression like "a > 5 AND b < 10".
5959
*/
6060
String tag() default TAG_PLACEHOLDER;
6161

@@ -75,17 +75,10 @@
7575
String consumerGroup() default CONSUMER_GROUP_PLACEHOLDER;
7676

7777
/**
78-
* Control how to selector message.
79-
*
80-
* @see SelectorType
78+
* Control how to filter messages.
79+
* For TAG filterExpressionType, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
80+
* For SQL92 filterExpressionType, use SQL92 expression like "a > 5 AND b < 10".
8181
*/
82-
SelectorType selectorType() default SelectorType.TAG;
83-
84-
/**
85-
* @deprecated Use {@link #tag()} and {@link #selectorType()} instead.
86-
* This field will be removed in a future version.
87-
*/
88-
@Deprecated
8982
String filterExpressionType() default FILTER_EXPRESSION_TYPE_PLACEHOLDER;
9083

9184
/**

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/annotation/RocketMQMessageListener.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,7 @@
5454
String topic() default TOPIC_PLACEHOLDER;
5555

5656
/**
57-
* Control how to selector message.
58-
*
59-
* @see SelectorType
60-
*/
61-
SelectorType selectorType() default SelectorType.TAG;
62-
63-
/**
64-
* Control which message can be select. Grammar please see {@link SelectorType#TAG} and {@link SelectorType#SQL92}
57+
* Control which message can be select.
6558
* For TAG type, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
6659
* For SQL92 type, use SQL92 expression like "a > 5 AND b < 10".
6760
*/
@@ -73,11 +66,11 @@
7366
boolean sslEnabled() default true;
7467

7568
/**
76-
* @deprecated Use {@link #tag()} and {@link #selectorType()} instead.
77-
* This field will be removed in a future version.
69+
* Control how to filter messages.
70+
* For TAG filterExpressionType, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
71+
* For SQL92 filterExpressionType, use SQL92 expression like "a > 5 AND b < 10".
7872
*/
79-
@Deprecated
80-
String filterExpressionType() default "tag";
73+
String filterExpressionType() default TAG_PLACEHOLDER;
8174

8275
/**
8376
* The load balancing group for the simple consumer.

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/annotation/SelectorType.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtConsumerResetConfiguration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package org.apache.rocketmq.client.autoconfigure;
1818

19-
import org.apache.rocketmq.client.annotation.SelectorType;
2019
import org.apache.rocketmq.client.support.RocketMQMessageConverter;
2120
import org.apache.rocketmq.client.support.RocketMQUtil;
2221
import org.apache.rocketmq.client.apis.ClientConfiguration;
@@ -117,8 +116,8 @@ private SimpleConsumerInfo createConsumer(
117116
String endPoints = resolvePlaceholders(annotation.endpoints(), simpleConsumer.getEndpoints());
118117
String namespace = resolvePlaceholders(annotation.namespace(), simpleConsumer.getNamespace());
119118
String tag = resolvePlaceholders(annotation.tag(), simpleConsumer.getTag());
120-
// Use selectorType to determine the filter expression type, similar to rocketmq-spring-boot
121-
String filterExpressionType = annotation.selectorType() == SelectorType.TAG ? "tag" : "sql92";
119+
// Use filterExpressionType to determine the filter expression type, similar to rocketmq-spring-boot
120+
String filterExpressionType = annotation.filterExpressionType();
122121
Duration requestTimeout = Duration.ofSeconds(annotation.requestTimeout());
123122
int awaitDuration = annotation.awaitDuration();
124123
Boolean sslEnabled = simpleConsumer.isSslEnabled();

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ListenerContainerConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.apache.rocketmq.client.autoconfigure;
1818

1919
import org.apache.rocketmq.client.annotation.RocketMQMessageListener;
20-
import org.apache.rocketmq.client.annotation.SelectorType;
2120
import org.apache.rocketmq.client.core.RocketMQListener;
2221
import org.apache.rocketmq.client.support.DefaultListenerContainer;
2322
import org.apache.rocketmq.client.support.RocketMQMessageConverter;
@@ -109,8 +108,7 @@ private DefaultListenerContainer createRocketMQListenerContainer(String name, Ob
109108
container.setConsumptionThreadCount(annotation.consumptionThreadCount());
110109
container.setMaxCacheMessageSizeInBytes(annotation.maxCacheMessageSizeInBytes());
111110
// Use selectorType to determine the filter expression type, similar to rocketmq-spring-boot
112-
container.setType(annotation.selectorType() == SelectorType.TAG ? "tag" : "sql92");
113-
container.setSelectorType(annotation.selectorType());
111+
container.setType(annotation.filterExpressionType());
114112
container.setSslEnabled(annotation.sslEnabled());
115113
return container;
116114
}

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/RocketMQAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public SimpleConsumerBuilder simpleConsumerBuilder(RocketMQProperties rocketMQPr
105105
RocketMQProperties.SimpleConsumer simpleConsumer = rocketMQProperties.getSimpleConsumer();
106106
final ClientServiceProvider provider = ClientServiceProvider.loadService();
107107
String consumerGroup = simpleConsumer.getConsumerGroup();
108-
// Use selectorType to determine the filter expression type, similar to rocketmq-spring-boot
109-
String filterExpressionTypeValue = simpleConsumer.getSelectorType() != null ? simpleConsumer.getSelectorType() : "TAG";
108+
// Use filterExpressionType to determine the filter expression type, similar to rocketmq-spring-boot
109+
String filterExpressionTypeValue = simpleConsumer.getFilterExpressionType() != null ? simpleConsumer.getFilterExpressionType() : "TAG";
110110
String tagExpression = simpleConsumer.getTag() != null ? simpleConsumer.getTag() : "*";
111111
FilterExpression filterExpression = RocketMQUtil.createFilterExpression(tagExpression, filterExpressionTypeValue.toLowerCase());
112112
ClientConfiguration clientConfiguration = RocketMQUtil.createConsumerClientConfiguration(simpleConsumer);

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/RocketMQProperties.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ public static class SimpleConsumer {
202202
private int requestTimeout = 3;
203203

204204
/**
205-
* Control how to selector message.
206-
*
207-
* @see org.apache.rocketmq.client.annotation.SelectorType
205+
* Control how to filter messages.
206+
* For TAG filterExpressionType, use "*" to subscribe all messages, or use "tagA||tagB" for multiple tags.
207+
* For SQL92 filterExpressionType, use SQL92 expression like "a > 5 AND b < 10".
208208
*/
209-
private String selectorType = "TAG";
209+
private String filterExpressionType = "TAG";
210210

211211
/**
212212
* Enable or disable the use of Secure Sockets Layer (SSL) for network transport.
@@ -287,12 +287,12 @@ public void setSslEnabled(boolean sslEnabled) {
287287
this.sslEnabled = sslEnabled;
288288
}
289289

290-
public String getSelectorType() {
291-
return selectorType;
290+
public String getFilterExpressionType() {
291+
return filterExpressionType;
292292
}
293293

294-
public void setSelectorType(String selectorType) {
295-
this.selectorType = selectorType;
294+
public void setFilterExpressionType(String filterExpressionType) {
295+
this.filterExpressionType = filterExpressionType;
296296
}
297297

298298
public String getNamespace() {
@@ -312,7 +312,6 @@ public String toString() {
312312
", tag='" + tag + '\'' +
313313
", topic='" + topic + '\'' +
314314
", requestTimeout=" + requestTimeout +
315-
", selectorType='" + selectorType + '\'' +
316315
", sslEnabled=" + sslEnabled +
317316
", namespace='" + namespace + '\'' +
318317
'}';

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/DefaultListenerContainer.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.apache.rocketmq.client.support;
1818

1919
import org.apache.rocketmq.client.annotation.RocketMQMessageListener;
20-
import org.apache.rocketmq.client.annotation.SelectorType;
2120
import org.apache.rocketmq.client.apis.ClientConfiguration;
2221
import org.apache.rocketmq.client.apis.ClientServiceProvider;
2322
import org.apache.rocketmq.client.apis.consumer.PushConsumer;
@@ -74,7 +73,7 @@ public class DefaultListenerContainer implements InitializingBean,
7473

7574
String topic;
7675

77-
SelectorType selectorType;
76+
String filterExpressionType;
7877

7978
Duration requestTimeout;
8079

@@ -179,12 +178,12 @@ public void setRequestTimeout(Duration requestTimeout) {
179178
this.requestTimeout = requestTimeout;
180179
}
181180

182-
public SelectorType getSelectorType() {
183-
return selectorType;
181+
public String getFilterExpressionType() {
182+
return filterExpressionType;
184183
}
185184

186-
public void setSelectorType(SelectorType selectorType) {
187-
this.selectorType = selectorType;
185+
public void setFilterExpressionType(String filterExpressionType) {
186+
this.filterExpressionType = filterExpressionType;
188187
}
189188

190189
public Boolean getSslEnabled() {
@@ -231,7 +230,7 @@ public void setRocketMQMessageListener(RocketMQMessageListener rocketMQMessageLi
231230
this.endpoints = rocketMQMessageListener.endpoints();
232231
this.topic = rocketMQMessageListener.topic();
233232
this.tag = rocketMQMessageListener.tag();
234-
this.selectorType = rocketMQMessageListener.selectorType();
233+
this.filterExpressionType = rocketMQMessageListener.filterExpressionType();
235234
this.sslEnabled = rocketMQMessageListener.sslEnabled();
236235
this.consumerGroup = rocketMQMessageListener.consumerGroup();
237236
this.requestTimeout = Duration.ofSeconds(rocketMQMessageListener.requestTimeout());
@@ -273,9 +272,8 @@ private void initRocketMQPushConsumer() {
273272
Assert.hasText(topic, "Property 'topic' is required");
274273
Assert.hasText(tag, "Property 'tag' is required");
275274

276-
// Convert SelectorType to FilterExpressionType string for createFilterExpression
277-
String filterExpressionTypeStr = (selectorType != null && selectorType == SelectorType.SQL92)
278-
? "sql92" : "tag";
275+
// Use filterExpressionType directly instead of converting from SelectorType
276+
String filterExpressionTypeStr = this.getFilterExpressionType() != null ? this.getFilterExpressionType().toLowerCase() : "tag";
279277

280278
FilterExpression filterExpression = null;
281279
final ClientServiceProvider provider = ClientServiceProvider.loadService();
@@ -379,7 +377,7 @@ public String toString() {
379377
", consumerGroup='" + consumerGroup + '\'' +
380378
", tag='" + tag + '\'' +
381379
", topic='" + topic + '\'' +
382-
", selectorType=" + selectorType +
380+
", filterExpressionType='" + filterExpressionType + '\'' +
383381
", requestTimeout=" + requestTimeout +
384382
", maxCachedMessageCount=" + maxCachedMessageCount +
385383
", maxCacheMessageSizeInBytes=" + maxCacheMessageSizeInBytes +

0 commit comments

Comments
 (0)