Commit 2238632af10e6628f3a00fa9cc31ca17adcb7200
1 parent
defb86b1
C_G
Showing
4 changed files
with
25 additions
and
18 deletions
pom.xml
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | |
23 | 23 | <groupId>org.apache.rocketmq</groupId> |
24 | 24 | <artifactId>spring-boot-starter-rocketmq</artifactId> |
25 | - <version>1.0.6-SNAPSHOT</version> | |
25 | + <version>1.0.8-SNAPSHOT</version> | |
26 | 26 | |
27 | 27 | <name>Spring Boot Rocket Starter</name> |
28 | 28 | <description>Starter for messaging using Apache RocketMQ</description> |
... | ... | @@ -103,18 +103,18 @@ |
103 | 103 | </dependency> |
104 | 104 | </dependencies> |
105 | 105 | </dependencyManagement> |
106 | - <distributionManagement> | |
107 | - <repository> | |
108 | - <id>nexus_releases</id> | |
109 | - <name>core Release Repository</name> | |
110 | - <url>http://192.168.1.195:9999/nexus/content/repositories/releases/</url> | |
111 | - </repository> | |
112 | - <snapshotRepository> | |
113 | - <id>nexus_snapshots</id> | |
114 | - <name>core Snapshots Repository</name> | |
115 | - <url>http://192.168.1.195:9999/nexus/content/repositories/snapshots/</url> | |
116 | - </snapshotRepository> | |
117 | - </distributionManagement> | |
106 | + <distributionManagement> | |
107 | + <repository> | |
108 | + <id>nexus_releases</id> | |
109 | + <name>core Release Repository</name> | |
110 | + <url>http://maven.renniting.cn/nexus/content/repositories/releases/</url> | |
111 | + </repository> | |
112 | + <snapshotRepository> | |
113 | + <id>nexus_snapshots</id> | |
114 | + <name>core Snapshots Repository</name> | |
115 | + <url>http://maven.renniting.cn/nexus/content/repositories/snapshots/</url> | |
116 | + </snapshotRepository> | |
117 | + </distributionManagement> | |
118 | 118 | <build> |
119 | 119 | <plugins> |
120 | 120 | <plugin> | ... | ... |
src/main/java/org/apache/rocketmq/spring/starter/AliyunRocketMQAutoConfiguration.java
... | ... | @@ -76,8 +76,8 @@ import lombok.extern.slf4j.Slf4j; |
76 | 76 | public class AliyunRocketMQAutoConfiguration { |
77 | 77 | |
78 | 78 | @Bean |
79 | - @ConditionalOnClass(Producer.class) | |
80 | - @ConditionalOnMissingBean(Producer.class) | |
79 | + @ConditionalOnClass(RocketMQProperties.Producer.class) | |
80 | + @ConditionalOnMissingBean(RocketMQProperties.Producer.class) | |
81 | 81 | @ConditionalOnProperty(prefix = "spring.rocketmq", value = {"environmentPrefix", "producer.group"}) |
82 | 82 | public Producer mqProducer(RocketMQProperties rocketMQProperties) { |
83 | 83 | |
... | ... | @@ -88,7 +88,8 @@ public class AliyunRocketMQAutoConfiguration { |
88 | 88 | Assert.hasText(accessKey, "[spring.rocketmq.accessKey] must not be null"); |
89 | 89 | String secretKey = rocketMQProperties.getSecretKey(); |
90 | 90 | Assert.hasText(secretKey, "[spring.rocketmq.secretKey] must not be null"); |
91 | - String onsAddr = rocketMQProperties.getOnsAddr(); | |
91 | + // String onsAddr = rocketMQProperties.getOnsAddr(); | |
92 | + String namesrvAdder = rocketMQProperties.getNamesrvAdder(); | |
92 | 93 | Assert.hasText(secretKey, "[spring.rocketmq.onsAddr] must not be null"); |
93 | 94 | String environmentPrefix = rocketMQProperties.getEnvironmentPrefix(); |
94 | 95 | Assert.hasText(secretKey, "[spring.rocketmq.environmentPrefix] must not be null"); |
... | ... | @@ -100,7 +101,8 @@ public class AliyunRocketMQAutoConfiguration { |
100 | 101 | producerProperties.setProperty(PropertyKeyConst.ProducerId, pid); |
101 | 102 | producerProperties.setProperty(PropertyKeyConst.AccessKey, accessKey); |
102 | 103 | producerProperties.setProperty(PropertyKeyConst.SecretKey, secretKey); |
103 | - producerProperties.setProperty(PropertyKeyConst.ONSAddr, onsAddr); | |
104 | + producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, namesrvAdder); | |
105 | + //producerProperties.setProperty(PropertyKeyConst.ONSAddr, onsAddr); | |
104 | 106 | Producer producer = ONSFactory.createProducer(producerProperties); |
105 | 107 | return producer; |
106 | 108 | } |
... | ... | @@ -182,7 +184,8 @@ public class AliyunRocketMQAutoConfiguration { |
182 | 184 | RocketMQListener rocketMQListener = (RocketMQListener) bean; |
183 | 185 | RocketMQMessageListener annotation = clazz.getAnnotation(RocketMQMessageListener.class); |
184 | 186 | BeanDefinitionBuilder beanBuilder = BeanDefinitionBuilder.rootBeanDefinition(AliyunRocketMQListenerContainer.class); |
185 | - beanBuilder.addPropertyValue(PROP_ONS_Addr, rocketMQProperties.getOnsAddr()); | |
187 | + beanBuilder.addPropertyValue(PROP_NAMESRV_Addr, rocketMQProperties.getNamesrvAdder()); | |
188 | + // beanBuilder.addPropertyValue(PROP_ONS_Addr, rocketMQProperties.getOnsAddr()); | |
186 | 189 | String topic = rocketMQProperties.getEnvironmentPrefix()+"_"+environment.resolvePlaceholders(annotation.topic()); |
187 | 190 | log.info(uuid+"订阅的主题topic:"+topic); |
188 | 191 | beanBuilder.addPropertyValue(PROP_TOPIC, topic); | ... | ... |
src/main/java/org/apache/rocketmq/spring/starter/RocketMQProperties.java
src/main/java/org/apache/rocketmq/spring/starter/core/DefaultRocketMQListenerContainerConstants.java
... | ... | @@ -34,6 +34,8 @@ public final class DefaultRocketMQListenerContainerConstants { |
34 | 34 | public static final String METHOD_DESTROY = "destroy"; |
35 | 35 | public static final String PROP_ROCKETMQ_TEMPLATE = "rocketMQTemplate"; |
36 | 36 | public static final String PROP_ONS_Addr = "onsAddr"; |
37 | + | |
38 | + public static final String PROP_NAMESRV_Addr = "namesrvAdder"; | |
37 | 39 | public static final String PROP_ACCESS_KEY = "accessKey"; |
38 | 40 | public static final String PROP_SECRET_KEY = "secretKey"; |
39 | 41 | /** | ... | ... |