mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Updates to spring cloud greenwich
This commit is contained in:
parent
94a3bc2cc2
commit
1dc80d7a6f
10
pom.xml
10
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-build</artifactId>
|
<artifactId>spring-cloud-build</artifactId>
|
||||||
<version>2.0.4.RELEASE</version>
|
<version>2.1.2.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -66,10 +66,10 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Dependency Versions -->
|
<!-- Dependency Versions -->
|
||||||
<spring-cloud-commons.version>2.0.2.RELEASE</spring-cloud-commons.version>
|
<spring-cloud-commons.version>2.1.0.RELEASE</spring-cloud-commons.version>
|
||||||
<spring-cloud-netflix.version>2.0.2.RELEASE</spring-cloud-netflix.version>
|
<spring-cloud-netflix.version>2.1.0.RELEASE</spring-cloud-netflix.version>
|
||||||
<spring-cloud-openfeign.version>2.0.2.RELEASE</spring-cloud-openfeign.version>
|
<spring-cloud-openfeign.version>2.1.0.RELEASE</spring-cloud-openfeign.version>
|
||||||
<spring-cloud-bus.version>2.0.0.RELEASE</spring-cloud-bus.version>
|
<spring-cloud-bus.version>2.1.0.RELEASE</spring-cloud-bus.version>
|
||||||
|
|
||||||
<junit.version>4.12</junit.version>
|
<junit.version>4.12</junit.version>
|
||||||
<javax-servlet-api>3.0</javax-servlet-api>
|
<javax-servlet-api>3.0</javax-servlet-api>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<version>2.0.4.RELEASE</version>
|
<version>2.1.2.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import org.apache.rocketmq.client.producer.TransactionCheckListener;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.stream.binder.AbstractMessageChannelBinder;
|
import org.springframework.cloud.stream.binder.AbstractMessageChannelBinder;
|
||||||
|
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
|
||||||
import org.springframework.cloud.stream.binder.ExtendedConsumerProperties;
|
import org.springframework.cloud.stream.binder.ExtendedConsumerProperties;
|
||||||
import org.springframework.cloud.stream.binder.ExtendedProducerProperties;
|
import org.springframework.cloud.stream.binder.ExtendedProducerProperties;
|
||||||
import org.springframework.cloud.stream.binder.ExtendedPropertiesBinder;
|
import org.springframework.cloud.stream.binder.ExtendedPropertiesBinder;
|
||||||
@ -53,19 +54,18 @@ public class RocketMQMessageChannelBinder extends
|
|||||||
private static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(RocketMQMessageChannelBinder.class);
|
.getLogger(RocketMQMessageChannelBinder.class);
|
||||||
|
|
||||||
private final RocketMQExtendedBindingProperties extendedBindingProperties;
|
|
||||||
private final RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties;
|
private final RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties;
|
||||||
private final InstrumentationManager instrumentationManager;
|
private final InstrumentationManager instrumentationManager;
|
||||||
private final ConsumersManager consumersManager;
|
private final ConsumersManager consumersManager;
|
||||||
|
|
||||||
|
private RocketMQExtendedBindingProperties extendedBindingProperties = new RocketMQExtendedBindingProperties();
|
||||||
|
|
||||||
public RocketMQMessageChannelBinder(ConsumersManager consumersManager,
|
public RocketMQMessageChannelBinder(ConsumersManager consumersManager,
|
||||||
RocketMQExtendedBindingProperties extendedBindingProperties,
|
|
||||||
RocketMQTopicProvisioner provisioningProvider,
|
RocketMQTopicProvisioner provisioningProvider,
|
||||||
RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties,
|
RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties,
|
||||||
InstrumentationManager instrumentationManager) {
|
InstrumentationManager instrumentationManager) {
|
||||||
super(null, provisioningProvider);
|
super(null, provisioningProvider);
|
||||||
this.consumersManager = consumersManager;
|
this.consumersManager = consumersManager;
|
||||||
this.extendedBindingProperties = extendedBindingProperties;
|
|
||||||
this.rocketBinderConfigurationProperties = rocketBinderConfigurationProperties;
|
this.rocketBinderConfigurationProperties = rocketBinderConfigurationProperties;
|
||||||
this.instrumentationManager = instrumentationManager;
|
this.instrumentationManager = instrumentationManager;
|
||||||
}
|
}
|
||||||
@ -143,6 +143,16 @@ public class RocketMQMessageChannelBinder extends
|
|||||||
return extendedBindingProperties.getExtendedProducerProperties(channelName);
|
return extendedBindingProperties.getExtendedProducerProperties(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultsPrefix() {
|
||||||
|
return extendedBindingProperties.getDefaultsPrefix();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends BinderSpecificPropertiesProvider> getExtendedPropertiesEntryClass() {
|
||||||
|
return extendedBindingProperties.getExtendedPropertiesEntryClass();
|
||||||
|
}
|
||||||
|
|
||||||
private <T> T getClassConfiguration(String destName, String className,
|
private <T> T getClassConfiguration(String destName, String className,
|
||||||
Class<T> interfaceClass) {
|
Class<T> interfaceClass) {
|
||||||
if (StringUtils.isEmpty(className)) {
|
if (StringUtils.isEmpty(className)) {
|
||||||
@ -184,4 +194,9 @@ public class RocketMQMessageChannelBinder extends
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExtendedBindingProperties(
|
||||||
|
RocketMQExtendedBindingProperties extendedBindingProperties) {
|
||||||
|
this.extendedBindingProperties = extendedBindingProperties;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,9 @@ public class RocketMQBinderAutoConfiguration {
|
|||||||
RocketMQTopicProvisioner provisioningProvider,
|
RocketMQTopicProvisioner provisioningProvider,
|
||||||
ConsumersManager consumersManager) {
|
ConsumersManager consumersManager) {
|
||||||
RocketMQMessageChannelBinder binder = new RocketMQMessageChannelBinder(
|
RocketMQMessageChannelBinder binder = new RocketMQMessageChannelBinder(
|
||||||
consumersManager, extendedBindingProperties, provisioningProvider,
|
consumersManager, provisioningProvider,
|
||||||
rocketBinderConfigurationProperties, instrumentationManager);
|
rocketBinderConfigurationProperties, instrumentationManager);
|
||||||
|
binder.setExtendedBindingProperties(extendedBindingProperties);
|
||||||
return binder;
|
return binder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,16 +16,19 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.stream.binder.rocketmq.properties;
|
package org.springframework.cloud.stream.binder.rocketmq.properties;
|
||||||
|
|
||||||
|
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Timur Valiev
|
* @author Timur Valiev
|
||||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||||
*/
|
*/
|
||||||
public class RocketMQBindingProperties {
|
public class RocketMQBindingProperties implements BinderSpecificPropertiesProvider {
|
||||||
|
|
||||||
private RocketMQConsumerProperties consumer = new RocketMQConsumerProperties();
|
private RocketMQConsumerProperties consumer = new RocketMQConsumerProperties();
|
||||||
|
|
||||||
private RocketMQProducerProperties producer = new RocketMQProducerProperties();
|
private RocketMQProducerProperties producer = new RocketMQProducerProperties();
|
||||||
|
|
||||||
|
@Override
|
||||||
public RocketMQConsumerProperties getConsumer() {
|
public RocketMQConsumerProperties getConsumer() {
|
||||||
return consumer;
|
return consumer;
|
||||||
}
|
}
|
||||||
@ -34,6 +37,7 @@ public class RocketMQBindingProperties {
|
|||||||
this.consumer = consumer;
|
this.consumer = consumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public RocketMQProducerProperties getProducer() {
|
public RocketMQProducerProperties getProducer() {
|
||||||
return producer;
|
return producer;
|
||||||
}
|
}
|
||||||
|
@ -16,71 +16,27 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.stream.binder.rocketmq.properties;
|
package org.springframework.cloud.stream.binder.rocketmq.properties;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.cloud.stream.binder.ExtendedBindingProperties;
|
import org.springframework.cloud.stream.binder.AbstractExtendedBindingProperties;
|
||||||
|
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Timur Valiev
|
* @author Timur Valiev
|
||||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties("spring.cloud.stream.rocketmq")
|
@ConfigurationProperties("spring.cloud.stream.rocketmq")
|
||||||
public class RocketMQExtendedBindingProperties implements
|
public class RocketMQExtendedBindingProperties extends
|
||||||
ExtendedBindingProperties<RocketMQConsumerProperties, RocketMQProducerProperties> {
|
AbstractExtendedBindingProperties<RocketMQConsumerProperties, RocketMQProducerProperties, RocketMQBindingProperties> {
|
||||||
|
|
||||||
private Map<String, RocketMQBindingProperties> bindings = new HashMap<>();
|
private static final String DEFAULTS_PREFIX = "spring.cloud.stream.rocketmq.default";
|
||||||
|
|
||||||
public Map<String, RocketMQBindingProperties> getBindings() {
|
@Override
|
||||||
return this.bindings;
|
public String getDefaultsPrefix() {
|
||||||
}
|
return DEFAULTS_PREFIX;
|
||||||
|
|
||||||
public void setBindings(Map<String, RocketMQBindingProperties> bindings) {
|
|
||||||
this.bindings = bindings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized RocketMQConsumerProperties getExtendedConsumerProperties(
|
public Class<? extends BinderSpecificPropertiesProvider> getExtendedPropertiesEntryClass() {
|
||||||
String channelName) {
|
return RocketMQBindingProperties.class;
|
||||||
if (bindings.containsKey(channelName)) {
|
|
||||||
if (bindings.get(channelName).getConsumer() != null) {
|
|
||||||
return bindings.get(channelName).getConsumer();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RocketMQConsumerProperties properties = new RocketMQConsumerProperties();
|
|
||||||
this.bindings.get(channelName).setConsumer(properties);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RocketMQConsumerProperties properties = new RocketMQConsumerProperties();
|
|
||||||
RocketMQBindingProperties rbp = new RocketMQBindingProperties();
|
|
||||||
rbp.setConsumer(properties);
|
|
||||||
bindings.put(channelName, rbp);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized RocketMQProducerProperties getExtendedProducerProperties(
|
|
||||||
String channelName) {
|
|
||||||
if (bindings.containsKey(channelName)) {
|
|
||||||
if (bindings.get(channelName).getProducer() != null) {
|
|
||||||
return bindings.get(channelName).getProducer();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RocketMQProducerProperties properties = new RocketMQProducerProperties();
|
|
||||||
this.bindings.get(channelName).setProducer(properties);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RocketMQProducerProperties properties = new RocketMQProducerProperties();
|
|
||||||
RocketMQBindingProperties rbp = new RocketMQBindingProperties();
|
|
||||||
rbp.setProducer(properties);
|
|
||||||
bindings.put(channelName, rbp);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user