mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync binder to 1.x
This commit is contained in:
parent
2ad46027cf
commit
2b9cae20b8
@ -25,7 +25,7 @@
|
||||
<aliyun.sdk.version>4.0.1</aliyun.sdk.version>
|
||||
<alicloud.context.version>1.0.5</alicloud.context.version>
|
||||
<aliyun.sdk.edas.version>2.16.0</aliyun.sdk.edas.version>
|
||||
<rocketmq.starter.version>2.0.2-SNAPSHOT</rocketmq.starter.version>
|
||||
<rocketmq.starter.version>2.0.2</rocketmq.starter.version>
|
||||
<schedulerX.client.version>2.1.6</schedulerX.client.version>
|
||||
<aliyun.java.sdk.dysmsapi>1.1.0</aliyun.java.sdk.dysmsapi>
|
||||
<aliyun.sdk.mns>1.1.8</aliyun.sdk.mns>
|
||||
|
@ -16,12 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.alibaba.cloud.examples;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState;
|
||||
import org.apache.rocketmq.spring.support.RocketMQHeaders;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
@ -32,8 +29,7 @@ public class TransactionListenerImpl implements RocketMQLocalTransactionListener
|
||||
@Override
|
||||
public RocketMQLocalTransactionState executeLocalTransaction(Message msg,
|
||||
Object arg) {
|
||||
Object num = ((HashMap) msg.getHeaders().get(RocketMQHeaders.PROPERTIES))
|
||||
.get("USERS_test");
|
||||
Object num = msg.getHeaders().get("test");
|
||||
|
||||
if ("1".equals(num)) {
|
||||
System.out.println(
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class RocketMQBinderUtils {
|
||||
|
||||
public static RocketMQBinderConfigurationProperties mergeProducerProperties(
|
||||
public static RocketMQBinderConfigurationProperties mergeProperties(
|
||||
RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties,
|
||||
RocketMQProperties rocketMQProperties) {
|
||||
RocketMQBinderConfigurationProperties result = new RocketMQBinderConfigurationProperties();
|
||||
|
@ -17,9 +17,7 @@
|
||||
package org.springframework.cloud.stream.binder.rocketmq;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.rocketmq.acl.common.AclClientRPCHook;
|
||||
import org.apache.rocketmq.acl.common.SessionCredentials;
|
||||
@ -63,7 +61,6 @@ public class RocketMQMessageChannelBinder extends
|
||||
private final RocketMQProperties rocketMQProperties;
|
||||
private final InstrumentationManager instrumentationManager;
|
||||
|
||||
private Set<String> clientConfigId = new HashSet<>();
|
||||
private Map<String, String> topicInUse = new HashMap<>();
|
||||
|
||||
public RocketMQMessageChannelBinder(
|
||||
@ -86,7 +83,7 @@ public class RocketMQMessageChannelBinder extends
|
||||
if (producerProperties.getExtension().getEnabled()) {
|
||||
|
||||
RocketMQBinderConfigurationProperties mergedProperties = RocketMQBinderUtils
|
||||
.mergeProducerProperties(rocketBinderConfigurationProperties,
|
||||
.mergeProperties(rocketBinderConfigurationProperties,
|
||||
rocketMQProperties);
|
||||
|
||||
RocketMQTemplate rocketMQTemplate;
|
||||
@ -102,7 +99,6 @@ public class RocketMQMessageChannelBinder extends
|
||||
"there is more than 1 RocketMQTemplates in Spring BeanFactory");
|
||||
}
|
||||
rocketMQTemplate = rocketMQTemplates.values().iterator().next();
|
||||
clientConfigId.add(rocketMQTemplate.getProducer().buildMQClientId());
|
||||
}
|
||||
else {
|
||||
rocketMQTemplate = new RocketMQTemplate();
|
||||
@ -142,7 +138,6 @@ public class RocketMQMessageChannelBinder extends
|
||||
producer.setMaxMessageSize(
|
||||
producerProperties.getExtension().getMaxMessageSize());
|
||||
rocketMQTemplate.setProducer(producer);
|
||||
clientConfigId.add(producer.buildMQClientId());
|
||||
}
|
||||
|
||||
RocketMQMessageHandler messageHandler = new RocketMQMessageHandler(
|
||||
@ -217,10 +212,6 @@ public class RocketMQMessageChannelBinder extends
|
||||
return extendedBindingProperties.getExtendedProducerProperties(channelName);
|
||||
}
|
||||
|
||||
public Set<String> getClientConfigId() {
|
||||
return clientConfigId;
|
||||
}
|
||||
|
||||
public Map<String, String> getTopicInUse() {
|
||||
return topicInUse;
|
||||
}
|
||||
|
@ -258,8 +258,6 @@ public class RocketMQListenerBindingContainer
|
||||
.prepareStart(consumer);
|
||||
}
|
||||
|
||||
rocketMQMessageChannelBinder.getClientConfigId().add(consumer.buildMQClientId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user