Skip to content

Commit

Permalink
RocketMQ code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorieee committed Jul 10, 2022
1 parent 16e7de6 commit 3c38932
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.alibaba.cloud.stream.binder.rocketmq;

import com.alibaba.cloud.stream.binder.rocketmq.constant.RocketMQConst;
import com.alibaba.cloud.stream.binder.rocketmq.custom.RocketMQBeanContainerCache;
import com.alibaba.cloud.stream.binder.rocketmq.extend.ErrorAcknowledgeHandler;
import com.alibaba.cloud.stream.binder.rocketmq.integration.inbound.RocketMQInboundChannelAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,22 @@ public static DefaultMQPushConsumer initPushConsumer(

/**
* todo Compatible with versions less than 4.6 ?
* @param topic
* @param topic consumer topic.
* @param extendedConsumerProperties extendedConsumerProperties
* @return DefaultLitePullConsumer
*/
public static DefaultLitePullConsumer initPullConsumer(
String topic,
public static DefaultLitePullConsumer initPullConsumer(String topic,
ExtendedConsumerProperties<RocketMQConsumerProperties> extendedConsumerProperties) {
RocketMQConsumerProperties consumerProperties = extendedConsumerProperties
.getExtension();
boolean anonymous = !StringUtils.hasLength(consumerProperties.getGroup());
/***
* When using DLQ, at least the group property must be provided for proper naming of the DLQ destination
* According to https://docs.spring.io/spring-cloud-stream/docs/3.2.1/reference/html/spring-cloud-stream.html#spring-cloud-stream-reference
* When using DLQ, at least the group property must be provided for proper naming
* of the DLQ destination According to
* https://docs.spring.io/spring-cloud-stream/docs/3.2.1/reference/html/spring-cloud-stream.html#spring-cloud-stream-reference
*/
if (anonymous && NamespaceUtil.isDLQTopic(topic)) {
throw new RuntimeException(
"group must be configured for DLQ" + topic);
throw new RuntimeException("group must be configured for DLQ" + topic);
}
if (anonymous) {
consumerProperties.setGroup(RocketMQUtils.anonymousGroup(topic));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public synchronized void start() {
throw new IllegalStateException(
"pull consumer already running. " + this.toString());
}
this.consumer = RocketMQConsumerFactory
.initPullConsumer(topic, extendedConsumerProperties);
this.consumer = RocketMQConsumerFactory.initPullConsumer(topic,
extendedConsumerProperties);
// This parameter must be 1, otherwise doReceive cannot be handled singly.
// this.consumer.setPullBatchSize(1);
this.consumer.subscribe(topic, messageSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@ public static MessageSelector getMessageSelector(String expression) {
public static String anonymousGroup(final String destination) {
return RocketMQConst.DEFAULT_GROUP + "_" + destination;
}

}

0 comments on commit 3c38932

Please sign in to comment.