同一服务器: 192.168.100.228
RpcServiceContext serviceContext = RpcContext.getServiceContext();
//web->buss-service
LOGGER.warn("getRequest->{}", JsonUtil.toJson(serviceContext.getRequest()));
//getRequest->null
LOGGER.warn("getResponse->{}", JsonUtil.toJson(serviceContext.getResponse()));
//getResponse->null
LOGGER.warn("get->{}", JsonUtil.toJson(serviceContext.get()));
//get->{}
LOGGER.warn("getAttachments->{}", JsonUtil.toJson(serviceContext.getAttachments()));
//getAttachments->{"traceId":"aaef470a3a164379b4f12517f743f5d6","input":"392","remote.application":"web"}
LOGGER.warn("getInterfaceName->{}", JsonUtil.toJson(serviceContext.getInterfaceName()));
//getInterfaceName->null
LOGGER.warn("getLocalAddressString->{}", JsonUtil.toJson(serviceContext.getLocalAddressString()));
//getLocalAddressString->192.168.100.228:21000
LOGGER.warn("getLocalHost->{}", JsonUtil.toJson(serviceContext.getLocalHost()));
//getLocalHost->192.168.100.228
LOGGER.warn("getLocalHostName->{}", JsonUtil.toJson(serviceContext.getLocalHostName()));
//getLocalHostName->192.168.100.228
LOGGER.warn("getLocalPort->{}", JsonUtil.toJson(serviceContext.getLocalPort()));
//getLocalPort->21000
LOGGER.warn("getMethodName->{}", JsonUtil.toJson(serviceContext.getMethodName()));
//getMethodName->test
LOGGER.warn("getObjectAttachments->{}", JsonUtil.toJson(serviceContext.getObjectAttachments()));
//getObjectAttachments->{"traceId":"aaef470a3a164379b4f12517f743f5d6","input":"392","remote.application":"web"}
LOGGER.warn("getRemoteAddressString->{}", JsonUtil.toJson(serviceContext.getRemoteAddressString()));
//getRemoteAddressString->192.168.100.228:36992
LOGGER.warn("getRemoteApplicationName->{}", JsonUtil.toJson(serviceContext.getRemoteApplicationName()));
//getRemoteApplicationName->web
LOGGER.warn("getRemoteHost->{}", JsonUtil.toJson(serviceContext.getRemoteHost()));
//getRemoteHost->192.168.100.228
LOGGER.warn("getRemoteHostName->{}", JsonUtil.toJson(serviceContext.getRemoteHostName()));
//getRemoteHostName->saas-network-01
LOGGER.warn("getRemotePort->{}", JsonUtil.toJson(serviceContext.getRemotePort()));
//getRemotePort->36992
URL url = serviceContext.getUrl();
if(url != null) {
LOGGER.warn("getAbsolutePath->{}", JsonUtil.toJson(url.getAbsolutePath()));
//getAbsolutePath->/com.myb.wh.buss.service.base.FileService
LOGGER.warn("getAddress->{}", JsonUtil.toJson(url.getAddress()));
//getAddress->192.168.100.228:21000
LOGGER.warn("getAllParameters->{}", JsonUtil.toJson(url.getAllParameters()));
//getAllParameters->{"release":"3.1.0","dubbo":"2.0.2","interface":"com.myb.wh.buss.service.base.FileService","application":"buss-service","anyhost":"true","pid":"3178994","side":"provider","metadata-type":"remote","methods":"copyFile,deleteFile,getUploadParam,deleteFolder,test,upload,html2Jpg,getFilesByDirectory,ofd2Pdf,jpg2Pdf,batchDeleteFile,html2Pdf,watermarkDIY","logger":"slf4j","deprecated":"false","service-name-mapping":"true","qos.enable":"false","timeout":"10000","bind.port":"21000","register-mode":"instance","generic":"false","bind.ip":"192.168.100.228","payload":"8388608","background":"false","dynamic":"true","service.filter":"dubboExceptionFilter,-exception","dispatcher":"message","qos.accept.foreign.ip":"false","timestamp":"1700834530470"}
LOGGER.warn("getParameters->{}", JsonUtil.toJson(url.getParameters()));
//getParameters->{"release":"3.1.0","dubbo":"2.0.2","interface":"com.myb.wh.buss.service.base.FileService","application":"buss-service","anyhost":"true","pid":"3178994","side":"provider","metadata-type":"remote","methods":"copyFile,deleteFile,getUploadParam,deleteFolder,test,upload,html2Jpg,getFilesByDirectory,ofd2Pdf,jpg2Pdf,batchDeleteFile,html2Pdf,watermarkDIY","logger":"slf4j","deprecated":"false","service-name-mapping":"true","qos.enable":"false","timeout":"10000","bind.port":"21000","register-mode":"instance","generic":"false","bind.ip":"192.168.100.228","payload":"8388608","background":"false","dynamic":"true","service.filter":"dubboExceptionFilter,-exception","dispatcher":"message","qos.accept.foreign.ip":"false","timestamp":"1700834530470"}
LOGGER.warn("getPath->{}", JsonUtil.toJson(url.getPath()));
//getPath->com.myb.wh.buss.service.base.FileService
LOGGER.warn("getServiceInterface->{}", JsonUtil.toJson(url.getServiceInterface()));
//getServiceInterface->com.myb.wh.buss.service.base.FileService
LOGGER.warn("getServiceKey->{}", JsonUtil.toJson(url.getServiceKey()));
//getServiceKey->com.myb.wh.buss.service.base.FileService
LOGGER.warn("getIp->{}", JsonUtil.toJson(url.getIp()));
//getIp->192.168.100.228
LOGGER.warn("getApplication->{}", JsonUtil.toJson(url.getApplication()));
//getApplication->buss-service
LOGGER.warn("getBackupAddress->{}", JsonUtil.toJson(url.getBackupAddress()));
//getBackupAddress->192.168.100.228:21000
LOGGER.warn("getHost->{}", JsonUtil.toJson(url.getHost()));
//getHost->192.168.100.228
LOGGER.warn("getPort->{}", JsonUtil.toJson(url.getPort()));
//getPort->21000
LOGGER.warn("getRemoteApplication->{}", JsonUtil.toJson(url.getRemoteApplication()));
//getRemoteApplication->null
LOGGER.warn("getServiceName->{}", JsonUtil.toJson(url.getServiceName()));
//getServiceName->com.myb.wh.buss.service.base.FileService
LOGGER.warn("getSide->{}", JsonUtil.toJson(url.getSide()));
//getSide->provider
ServiceModel serviceModel = url.getServiceModel();
if(serviceModel != null) {
LOGGER.warn("getServiceKey->{}", JsonUtil.toJson(serviceModel.getServiceKey()));
//getServiceKey->com.myb.wh.buss.service.base.FileService
LOGGER.warn("getServiceName->{}", JsonUtil.toJson(serviceModel.getServiceName()));
//getServiceName->com.myb.wh.buss.service.base.FileService
}
}
//如果buss-service还是消费者, 链路继续调用其它提供者, 下面将会有值, 具体属性值, 基本和上面URL一致
URL consumerUrl = serviceContext.getConsumerUrl();
if(consumerUrl != null) { //为null
LOGGER.warn("getAbsolutePath->{}", JsonUtil.toJson(consumerUrl.getAbsolutePath()));
LOGGER.warn("getAddress->{}", JsonUtil.toJson(consumerUrl.getAddress()));
LOGGER.warn("getAllParameters->{}", JsonUtil.toJson(consumerUrl.getAllParameters()));
LOGGER.warn("getApplication->{}", JsonUtil.toJson(consumerUrl.getApplication()));
LOGGER.warn("getBackupAddress->{}", JsonUtil.toJson(consumerUrl.getBackupAddress()));
LOGGER.warn("getAuthority->{}", JsonUtil.toJson(consumerUrl.getAuthority()));
LOGGER.warn("getCategory->{}", JsonUtil.toJson(consumerUrl.getCategory()));
LOGGER.warn("getIp->{}", JsonUtil.toJson(consumerUrl.getIp()));
LOGGER.warn("getPath->{}", JsonUtil.toJson(consumerUrl.getPath()));
LOGGER.warn("getParametersv", JsonUtil.toJson(consumerUrl.getParameters()));
LOGGER.warn("getPort->{}", JsonUtil.toJson(consumerUrl.getPort()));
LOGGER.warn("getHost->{}", JsonUtil.toJson(consumerUrl.getHost()));
LOGGER.warn("getRemoteApplication->{}", JsonUtil.toJson(consumerUrl.getRemoteApplication()));
LOGGER.warn("getServiceInterface->{}", JsonUtil.toJson(consumerUrl.getServiceInterface()));
LOGGER.warn("getServiceName->{}", JsonUtil.toJson(consumerUrl.getServiceName()));
LOGGER.warn("getSide->{}", JsonUtil.toJson(consumerUrl.getSide()));
LOGGER.warn("getServiceKey->{}", JsonUtil.toJson(consumerUrl.getServiceKey()));
ServiceModel serviceModel = consumerUrl.getServiceModel();
if(serviceModel != null) {
LOGGER.warn("getServiceKey->{}", JsonUtil.toJson(serviceModel.getServiceKey()));
LOGGER.warn("getServiceName->{}", JsonUtil.toJson(serviceModel.getServiceName()));
}
}
上述为执行内容, 后面在碰到其它场景, 再补充吧, 一般够用了
原文地址:https://blog.csdn.net/u011271894/article/details/134608088
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_16027.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。