完成对Dubbox的埋点的测试
This commit is contained in:
parent
321cc60c96
commit
01b4ae5ca5
|
|
@ -1,121 +1,128 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>skywalking-sdk-plugin</artifactId>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>skywalking-sdk-plugin</artifactId>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>dubbo-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>dubbo-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>spring-plugin</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<name>spring-plugin</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Company nexus</id>
|
||||
<url>http://223.202.119.155:18081/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Company nexus</id>
|
||||
<url>http://10.1.228.199:18081/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-auth</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-client</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson-provider</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>8.0.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-logging-juli</artifactId>
|
||||
<version>8.0.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.101tec</groupId>
|
||||
<artifactId>zkclient</artifactId>
|
||||
<version>0.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbox</artifactId>
|
||||
<version>2.8.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>2.5.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-auth</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-client</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.0.0.GA</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson-provider</artifactId>
|
||||
<version>3.0.7.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>8.0.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-logging-juli</artifactId>
|
||||
<version>8.0.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.101tec</groupId>
|
||||
<artifactId>zkclient</artifactId>
|
||||
<version>0.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbox</artifactId>
|
||||
<version>2.8.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.alibaba</groupId>-->
|
||||
<!--<artifactId>dubbox</artifactId>-->
|
||||
<!--<version>2.8.4</version>-->
|
||||
<!--<scope>compile</scope>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.20.0-GA</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.ai.cloud.skywalking.buriedpoint.RPCBuriedPointReceiver;
|
|||
import com.ai.cloud.skywalking.buriedpoint.RPCBuriedPointSender;
|
||||
import com.ai.cloud.skywalking.model.ContextData;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve;
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.SWBaseBean;
|
||||
import com.alibaba.dubbo.common.extension.Activate;
|
||||
import com.alibaba.dubbo.rpc.*;
|
||||
|
||||
|
|
@ -16,10 +18,17 @@ public class SWDubboEnhanceFilter implements Filter {
|
|||
Result result = null;
|
||||
if (isConsumer) {
|
||||
RPCBuriedPointSender sender = new RPCBuriedPointSender();
|
||||
|
||||
ContextData contextData = sender.beforeSend(createIdentification(invoker, invocation));
|
||||
// 追加参数
|
||||
RpcInvocation rpcInvocation = (RpcInvocation) invocation;
|
||||
rpcInvocation.setAttachment("contextData", contextData.toString());
|
||||
String contextDataStr = contextData.toString();
|
||||
|
||||
//追加参数
|
||||
if (!BugFixAcitve.isActive) {
|
||||
context.setAttachment("contextData", contextDataStr);
|
||||
} else {
|
||||
fix283SendNoAttachmentIssue(invocation, contextDataStr);
|
||||
}
|
||||
|
||||
try {
|
||||
//执行结果
|
||||
result = invoker.invoke(invocation);
|
||||
|
|
@ -37,8 +46,14 @@ public class SWDubboEnhanceFilter implements Filter {
|
|||
} else {
|
||||
// 读取参数
|
||||
RPCBuriedPointReceiver rpcBuriedPointReceiver = new RPCBuriedPointReceiver();
|
||||
RpcInvocation rpcInvocation = (RpcInvocation) invocation;
|
||||
String contextDataStr = rpcInvocation.getAttachment("contextData");
|
||||
String contextDataStr;
|
||||
|
||||
if (!BugFixAcitve.isActive) {
|
||||
contextDataStr = context.getAttachment("contextData");
|
||||
} else {
|
||||
contextDataStr = fix283RecvNoAttachmentIssue(invocation);
|
||||
}
|
||||
|
||||
ContextData contextData = null;
|
||||
if (contextDataStr != null && contextDataStr.length() > 0) {
|
||||
contextData = new ContextData(contextDataStr);
|
||||
|
|
@ -83,4 +98,25 @@ public class SWDubboEnhanceFilter implements Filter {
|
|||
viewPoint.append(")");
|
||||
return Identification.newBuilder().viewPoint(viewPoint.toString()).spanType('D').build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void fix283SendNoAttachmentIssue(Invocation invocation, String contextDataStr) {
|
||||
|
||||
for (Object parameter : invocation.getArguments()) {
|
||||
if (parameter instanceof SWBaseBean) {
|
||||
((SWBaseBean) parameter).setContextData(contextDataStr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String fix283RecvNoAttachmentIssue(Invocation invocation) {
|
||||
for (Object parameter : invocation.getArguments()) {
|
||||
if (parameter instanceof SWBaseBean) {
|
||||
return ((SWBaseBean) parameter).getContextData();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283;
|
||||
|
||||
public final class BugFixAcitve {
|
||||
public static boolean isActive = false;
|
||||
|
||||
public BugFixAcitve(){
|
||||
isActive = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SWBaseBean implements Serializable {
|
||||
private String contextData;
|
||||
|
||||
public String getContextData() {
|
||||
return contextData;
|
||||
}
|
||||
|
||||
public void setContextData(String contextData) {
|
||||
this.contextData = contextData;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox.rest.consumer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DubboxRestConsumer {
|
||||
private static final Log logger = LogFactory.getLog(DubboxRestConsumer.class);
|
||||
|
||||
public static String sendPostRequest(String url, String data, Map<String, String> header) throws IOException,
|
||||
URISyntaxException {
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
HttpPost httpPost = new HttpPost(new URL(url).toURI());
|
||||
for (Map.Entry<String, String> entry : header.entrySet()) {
|
||||
httpPost.setHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
StringEntity dataEntity = new StringEntity(data, ContentType.APPLICATION_JSON);
|
||||
httpPost.setEntity(dataEntity);
|
||||
CloseableHttpResponse response = httpclient.execute(httpPost);
|
||||
try {
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
HttpEntity entity = response.getEntity();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
entity.getContent()));
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String tempStr;
|
||||
while ((tempStr = reader.readLine()) != null)
|
||||
buffer.append(tempStr);
|
||||
return buffer.toString();
|
||||
} else {
|
||||
throw new RuntimeException("error code " + response.getStatusLine().getStatusCode()
|
||||
+ ":" + response.getStatusLine().getReasonPhrase());
|
||||
}
|
||||
} finally {
|
||||
response.close();
|
||||
httpclient.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, URISyntaxException {
|
||||
String url = "http://192.168.1.102:20880/skywalking/rest-a/doBusiness";
|
||||
|
||||
String data = "{\"paramA\":\"BBBB\"}";
|
||||
sendPostRequest(url, data, new HashMap<String, String>());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox.rest.impl;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox.rest.interfaces.IDubboxRestInterA;
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
|
||||
@Service
|
||||
public class DubboxRestInterAImpl implements IDubboxRestInterA {
|
||||
public String doBusiness(String paramA) {
|
||||
System.out.println("param : " + paramA);
|
||||
return "{\"content\":\"" + paramA + "\"}";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox283.consumer;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.IDubboxRestInterA;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class DubboxRestConsumer {
|
||||
private static final Log logger = LogFactory.getLog(DubboxRestConsumer.class);
|
||||
|
||||
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
|
||||
new BugFixAcitve();
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:consumer/dubbox283-consumer.xml");
|
||||
IDubboxRestInterA dubboxRestInterA = context.getBean(IDubboxRestInterA.class);
|
||||
dubboxRestInterA.doBusiness(new DubboxRestInterAParameter("AAAAA"));
|
||||
Thread.sleep(10000000L);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox.rest.impl;
|
||||
package com.ai.cloud.skywalking.plugin.test.dubbox283.consumer;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class DubboxRestStart {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new BugFixAcitve();
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext = new
|
||||
ClassPathXmlApplicationContext("classpath*:provider/dubbox-provider.xml");
|
||||
ClassPathXmlApplicationContext("classpath*:provider/dubbox283-provider.xml");
|
||||
|
||||
classPathXmlApplicationContext.start();
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox283.impl;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.IDubboxRestInterA;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
|
||||
@Service
|
||||
public class DubboxRestInterAImpl implements IDubboxRestInterA {
|
||||
public String doBusiness(DubboxRestInterAParameter paramA) {
|
||||
System.out.println("param : " + paramA.getParameterA());
|
||||
return "{\"content\":\"" + paramA.getParameterA() + "\"}";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.impl.DubboxRestInterAImpl;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
@Path("/rest-a")
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
|
||||
public interface IDubboxRestInterA {
|
||||
|
||||
@Path("/doBusiness")
|
||||
@POST
|
||||
String doBusiness(DubboxRestInterAParameter paramA);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.SWBaseBean;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DubboxRestInterAParameter extends SWBaseBean {
|
||||
|
||||
|
||||
public DubboxRestInterAParameter() {
|
||||
}
|
||||
|
||||
@XmlElement(name = "parameterA")
|
||||
private String parameterA;
|
||||
|
||||
public DubboxRestInterAParameter(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
|
||||
public String getParameterA() {
|
||||
return parameterA;
|
||||
}
|
||||
|
||||
public void setParameterA(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox284.consumer;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces.IDubboxRestInterA;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class DubboxRestConsumer {
|
||||
private static final Log logger = LogFactory.getLog(DubboxRestConsumer.class);
|
||||
|
||||
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:consumer/dubbox284-consumer.xml");
|
||||
IDubboxRestInterA dubboxRestInterA = context.getBean(IDubboxRestInterA.class);
|
||||
dubboxRestInterA.doBusiness(new DubboxRestInterAParameter("AAAAA"));
|
||||
Thread.sleep(10000000L);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox284.consumer;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class DubboxRestStart {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new BugFixAcitve();
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext = new
|
||||
ClassPathXmlApplicationContext("classpath*:provider/dubbox284-provider.xml");
|
||||
|
||||
classPathXmlApplicationContext.start();
|
||||
|
||||
while (true) {
|
||||
Thread.sleep(100000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox284.impl;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces.IDubboxRestInterA;
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
|
||||
@Service
|
||||
public class DubboxRestInterAImpl implements IDubboxRestInterA {
|
||||
public String doBusiness(DubboxRestInterAParameter paramA) {
|
||||
System.out.println("param : " + paramA.getParameterA());
|
||||
return "{\"content\":\"" + paramA.getParameterA() + "\"}";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox.rest.interfaces;
|
||||
package com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.param.DubboxRestInterAParameter;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
|
|
@ -13,5 +15,5 @@ public interface IDubboxRestInterA {
|
|||
|
||||
@Path("/doBusiness")
|
||||
@POST
|
||||
String doBusiness(String paramA);
|
||||
String doBusiness(DubboxRestInterAParameter paramA);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces.param;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DubboxRestInterAParameter {
|
||||
|
||||
public DubboxRestInterAParameter() {
|
||||
}
|
||||
|
||||
@XmlElement(name = "parameterA")
|
||||
private String parameterA;
|
||||
|
||||
public DubboxRestInterAParameter(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
|
||||
public String getParameterA() {
|
||||
return parameterA;
|
||||
}
|
||||
|
||||
public void setParameterA(String parameterA) {
|
||||
this.parameterA = parameterA;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<dubbo:application name="skywalking-consumer"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:consumer filter="swEnhanceFilter"/>
|
||||
<dubbo:reference id="dubboInterA" interface="com.ai.cloud.skywalking.plugin.test.dubbo.interfaces.IDubboInterA"/>
|
||||
<dubbo:reference id="dubboInterA" interface="com.ai.cloud.skywalking.plugin.test.dubbo.interfaces.IDubboInterA"
|
||||
url="dubbo://192.168.1.108:20880"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-consumer"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:consumer filter="swEnhanceFilter"/>
|
||||
<dubbo:reference id="dubboxRestInterA" interface="com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.IDubboxRestInterA"
|
||||
url="rest://192.168.1.108:20880"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-consumer"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:consumer filter="swEnhanceFilter"/>
|
||||
<dubbo:reference id="dubboxRestInterA"
|
||||
interface="com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces.IDubboxRestInterA"
|
||||
url="rest://192.168.1.108:20880"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -7,9 +7,10 @@
|
|||
|
||||
<dubbo:application name="skywalking-dubbo-rest-provider"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:protocol name="rest" port="20880" server="tomcat" contextpath="skywalking"/>
|
||||
<dubbo:protocol name="rest" port="20880" server="tomcat"/>
|
||||
<dubbo:provider filter="swEnhanceFilter"/>
|
||||
<bean id="dubboxRestInterA" class="com.ai.cloud.skywalking.plugin.test.dubbox.rest.impl.DubboxRestInterAImpl"/>
|
||||
<dubbo:service interface="com.ai.cloud.skywalking.plugin.test.dubbox.rest.interfaces.IDubboxRestInterA" ref="dubboxRestInterA"/>
|
||||
<bean id="dubboxRestInterA" class="com.ai.cloud.skywalking.plugin.test.dubbox283.impl.DubboxRestInterAImpl"/>
|
||||
<dubbo:service interface="com.ai.cloud.skywalking.plugin.test.dubbox283.interfaces.IDubboxRestInterA"
|
||||
ref="dubboxRestInterA"/>
|
||||
|
||||
</beans>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="skywalking-dubbo-rest-provider"/>
|
||||
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
|
||||
<dubbo:protocol name="rest" port="20880" server="tomcat"/>
|
||||
<dubbo:provider filter="swEnhanceFilter"/>
|
||||
<bean id="dubboxRestInterA" class="com.ai.cloud.skywalking.plugin.test.dubbox284.impl.DubboxRestInterAImpl"/>
|
||||
<dubbo:service interface="com.ai.cloud.skywalking.plugin.test.dubbox284.interfaces.IDubboxRestInterA"
|
||||
ref="dubboxRestInterA"/>
|
||||
|
||||
</beans>
|
||||
Loading…
Reference in New Issue