-
Notifications
You must be signed in to change notification settings - Fork 4
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
提交一下 #1
Conversation
<dependency> | ||
<groupId>org.apache.rocketmq</groupId> | ||
<artifactId>rocketmq-spring-boot-starter</artifactId> | ||
<version>2.1.1</version> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) { | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
错误要打印
No description provided.