nogeek-cn commented on issue #4567: URL: https://github.com/apache/servicecomb-java-chassis/issues/4567#issuecomment-2434236191
文档地址不对 https://servicecomb.apache.org/references/java-chassis/zh_CN/general-development/context.html#context-discoverytree 应该是这个: 案例: 使用 Context 和 DiscoveryTree 实现轮询调用一个微服务的所有实例 ```java interface DateTimeSchemaWithContextInf { Date getDate(InvocationContext context, Date date); } @RpcReference(microserviceName = "springmvc", schemaId = "DateTimeSchema") private DateTimeSchemaWithContextInf dateTimeSchemaWithContextInf; // code slip for (String endpoint : enpoints) { InvocationContext invocationContext = new InvocationContext(); invocationContext.addLocalContext(LoadbalanceHandler.SERVICECOMB_SERVER_ENDPOINT, parseEndpoint(endpoint)); Date date = new Date(); TestMgr.check(date.getTime(), dateTimeSchemaWithContextInf.getDate(invocationContext, date).getTime()); } // code slip private Endpoint parseEndpoint(String endpointUri) throws Exception { URI formatUri = new URI(endpointUri); Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(formatUri.getScheme()); return new Endpoint(transport, endpointUri); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
