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