Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提交一下 #1

Merged
merged 5 commits into from
Jan 6, 2022
Merged

提交一下 #1

merged 5 commits into from
Jan 6, 2022

Conversation

nipeixuan
Copy link

No description provided.

<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.1.1</version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

统一到父pom定义

private static final Logger logger = LoggerFactory.getLogger(RocketAutoConfiguration.class);

@Value("${rocketmq.producer.group}")
String groupName;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最小作用域

funResult = sendBeforeFun.invoke(topic, sendHeader);
if (confirm) {
try {
SendResult result = rocketMQTemplate.syncSend(topic, msg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是同步方法,不得使用异步发送!下同。

sendErrorFun.invoke(e, funResult);
return false;
}
return true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少sendFinishFun调用

});
mqConsumer.start();
} catch (MQClientException e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不处理了?

SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
Map<String, Object> sendHeader = getMQHeader(address);
header.ifPresent(sendHeader::putAll);
Message<?> msg = MessageBuilder.withPayload(message).copyHeaders(sendHeader)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendBeforeFun哪去了

try {
for (MessageExt messageExt : list) {
String messageBody = new String(messageExt.getBody(), RemotingHelper.DEFAULT_CHARSET);
Map<String, String> map = messageExt.getProperties();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成Lambda表达式

consumer.accept(new MessageWrap(address, Optional.of(receiveHeader), messageBody));
}
} catch (Exception e) {
e.printStackTrace();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

禁止使用

});

} catch (Exception e) {
return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

错误要打印

@gudaoxuri gudaoxuri merged commit 282afe3 into starsys-tech:master Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants