mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
dubbo endpoint
This commit is contained in:
parent
4a2f90f13e
commit
8542756d90
2
pom.xml
2
pom.xml
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Project revision -->
|
<!-- Project revision -->
|
||||||
<revision>2.2.4.RELEASE</revision>
|
<revision>2.2.5.RC2</revision>
|
||||||
|
|
||||||
<!-- Dependency Versions -->
|
<!-- Dependency Versions -->
|
||||||
<spring-cloud-commons.version>2.2.5.RELEASE</spring-cloud-commons.version>
|
<spring-cloud-commons.version>2.2.5.RELEASE</spring-cloud-commons.version>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<description>Spring Cloud Alibaba Dependencies</description>
|
<description>Spring Cloud Alibaba Dependencies</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.2.4.RELEASE</revision>
|
<revision>2.2.5.RC2</revision>
|
||||||
<sentinel.version>1.8.0</sentinel.version>
|
<sentinel.version>1.8.0</sentinel.version>
|
||||||
<seata.version>1.3.0</seata.version>
|
<seata.version>1.3.0</seata.version>
|
||||||
<nacos.client.version>1.4.1</nacos.client.version>
|
<nacos.client.version>1.4.1</nacos.client.version>
|
||||||
|
@ -74,8 +74,9 @@ public class RocketMQConsumerApplication {
|
|||||||
while (true) {
|
while (true) {
|
||||||
mySink.input5().poll(m -> {
|
mySink.input5().poll(m -> {
|
||||||
String payload = (String) m.getPayload();
|
String payload = (String) m.getPayload();
|
||||||
if(payload.contains("0")){
|
if (payload.contains("0")) {
|
||||||
throw new IllegalArgumentException("111111111111111111111111111111111111111111");
|
throw new IllegalArgumentException(
|
||||||
|
"111111111111111111111111111111111111111111");
|
||||||
}
|
}
|
||||||
System.out.println("pull msg: " + payload);
|
System.out.println("pull msg: " + payload);
|
||||||
}, new ParameterizedTypeReference<String>() {
|
}, new ParameterizedTypeReference<String>() {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package com.alibaba.cloud.dubbo.actuate;
|
package com.alibaba.cloud.dubbo.actuate;
|
||||||
|
|
||||||
import com.alibaba.cloud.dubbo.actuate.endpoint.DubboDiscoveryEndpoint;
|
import com.alibaba.cloud.dubbo.actuate.endpoint.DubboDiscoveryEndpoint;
|
||||||
|
import com.alibaba.cloud.dubbo.actuate.endpoint.DubboExportedURLsEndpoint;
|
||||||
import com.alibaba.cloud.dubbo.actuate.endpoint.DubboRestMetadataEndpoint;
|
import com.alibaba.cloud.dubbo.actuate.endpoint.DubboRestMetadataEndpoint;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||||
@ -31,8 +32,7 @@ import org.springframework.context.annotation.PropertySource;
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
|
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
|
||||||
*/
|
*/
|
||||||
@ConditionalOnClass(
|
@ConditionalOnClass(name = "org.springframework.boot.actuate.endpoint.annotation.Endpoint")
|
||||||
name = "org.springframework.boot.actuate.endpoint.annotation.Endpoint")
|
|
||||||
@PropertySource("classpath:/META-INF/dubbo/default/actuator-endpoints.properties")
|
@PropertySource("classpath:/META-INF/dubbo/default/actuator-endpoints.properties")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
public class DubboMetadataEndpointAutoConfiguration {
|
public class DubboMetadataEndpointAutoConfiguration {
|
||||||
@ -48,7 +48,15 @@ public class DubboMetadataEndpointAutoConfiguration {
|
|||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
@ConditionalOnAvailableEndpoint
|
@ConditionalOnAvailableEndpoint
|
||||||
public DubboDiscoveryEndpoint dubboDiscoveryEndpoint() {
|
public DubboDiscoveryEndpoint dubboDiscoveryEndpoint() {
|
||||||
|
|
||||||
return new DubboDiscoveryEndpoint();
|
return new DubboDiscoveryEndpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
@ConditionalOnAvailableEndpoint
|
||||||
|
public DubboExportedURLsEndpoint dubboServiceMetadataEndpoint() {
|
||||||
|
return new DubboExportedURLsEndpoint();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
|||||||
/**
|
/**
|
||||||
* Dubbo Rest Metadata {@link Endpoint}.
|
* Dubbo Rest Metadata {@link Endpoint}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:chenxilzx1@gmail.com">Mercy</a>
|
* @author <a href="mailto:chenxilzx1@gmail.com">Theonefx</a>
|
||||||
*/
|
*/
|
||||||
@Endpoint(id = "dubbodiscovery")
|
@Endpoint(id = "dubboRegistryDirectory")
|
||||||
public class DubboDiscoveryEndpoint {
|
public class DubboDiscoveryEndpoint {
|
||||||
|
|
||||||
@ReadOperation(produces = APPLICATION_JSON_VALUE)
|
@ReadOperation(produces = APPLICATION_JSON_VALUE)
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2018 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.alibaba.cloud.dubbo.actuate.endpoint;
|
||||||
|
|
||||||
|
import com.alibaba.cloud.dubbo.service.DubboMetadataService;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||||
|
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||||
|
|
||||||
|
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dubbo exported URLs.
|
||||||
|
* {@link org.springframework.boot.actuate.endpoint.annotation.Endpoint}.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:chenxilzx1@gmail.com">Theonefx</a>
|
||||||
|
*/
|
||||||
|
@Endpoint(id = "dubboExportedURLs")
|
||||||
|
public class DubboExportedURLsEndpoint {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DubboMetadataService dubboMetadataService;
|
||||||
|
|
||||||
|
@ReadOperation(produces = APPLICATION_JSON_UTF8_VALUE)
|
||||||
|
public Object get() {
|
||||||
|
return dubboMetadataService.getAllExportedURLs();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user