RpcServiceContext上下文

消费者: web 

提供者: buss-service

同一服务器: 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("getSide->{}", JsonUtil.toJson(url.getSide()));
    //getSide->provider
	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
	}
}
			
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("getAttributes->{}", JsonUtil.toJson(consumerUrl.getAttributes()));
	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()));
		}
	}
}

上述为执行内容, 后面在碰到其它场景, 再补充吧, 一般够用了

你可能感兴趣的:(后台管理框架,JAVA,其它,java,dubbo)