mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed Rocketmq can not batch send messages when producer set namespace (#5202)
This commit is contained in:
@@ -52,6 +52,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
private DefaultMQProducer defaultMQProducer;
|
private DefaultMQProducer defaultMQProducer;
|
||||||
private static final String CLOUD_ACCESS_CHANNEL = "cloud";
|
private static final String CLOUD_ACCESS_CHANNEL = "cloud";
|
||||||
|
private static final String NAMESPACE_SEPARATOR = "%";
|
||||||
protected ThreadPoolExecutor sendPartitionExecutor;
|
protected ThreadPoolExecutor sendPartitionExecutor;
|
||||||
|
|
||||||
@Override public void init(Properties properties) {
|
@Override public void init(Properties properties) {
|
||||||
@@ -311,7 +312,11 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
// 获取一下messageQueue
|
// 获取一下messageQueue
|
||||||
DefaultMQProducerImpl innerProducer = this.defaultMQProducer.getDefaultMQProducerImpl();
|
DefaultMQProducerImpl innerProducer = this.defaultMQProducer.getDefaultMQProducerImpl();
|
||||||
TopicPublishInfo topicInfo = innerProducer.getTopicPublishInfoTable().get(messages.get(0).getTopic());
|
String topic = messages.get(0).getTopic();
|
||||||
|
if (StringUtils.isNotBlank(this.defaultMQProducer.getNamespace())) {
|
||||||
|
topic = this.defaultMQProducer.getNamespace() + NAMESPACE_SEPARATOR + topic;
|
||||||
|
}
|
||||||
|
TopicPublishInfo topicInfo = innerProducer.getTopicPublishInfoTable().get(topic);
|
||||||
if (topicInfo == null) {
|
if (topicInfo == null) {
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
sendMessage(message, partition);
|
sendMessage(message, partition);
|
||||||
|
|||||||
Reference in New Issue
Block a user