Skip to content

Conversation

wood001
Copy link

@wood001 wood001 commented Oct 7, 2017

#155 关于服务端和客户提供异步调用的能力

@WillemJiang
Copy link
Member

WillemJiang commented Oct 8, 2017

@wood001 感谢你的提交, 这里有一个错误和你的提交有关,还需要你看一下。

io.servicecomb.swagger.invocation.arguments.TestPojoConsumerEqualSwagger
Failed tests:
TestPojoConsumerEqualProducer.testObject:80 expected:<hello []abc> but was:<hello [hello ]abc>
TestPojoConsumerEqualSwagger.testObject:78 expected:<hello []abc> but was:<hello [hello ]abc>

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 86.395% when pulling fd7e4b0 on wood001:master into 1325ef9 on ServiceComb:master.

@WillemJiang
Copy link
Member

@wood001 能留一下你的联系方式吗? 有关异步处理的事情我们还需沟通一下。

SwaggerConsumerOperation consumerOperation = swaggerConsumer.findOperation(method.getName());
consumerOperation.getArgumentsMapper().toInvocation(args, invocation);

Response response = InvokerUtils.innerSyncInvoke(invocation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the sync invocation, I think this part change is only for supporting the return type signature.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,这次修改的代码重点关注在了服务端,consumer侧只是为了能够兼容服务端的接口做了下适配。
这次提交主要是用来讨论下方案,如果方案可以,我可以重新修改代码,实现完应用层服务端和客户端的异步能力。


ConsumerArgumentsMapper argsMapper =
consumerArgumentsFactory.createArgumentsMapper(swaggerMethod, consumerMethod);
Type producerMethodReturnType = consumerMethod.getGenericReturnType();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be better if we can extract a method here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,对于异步返回的类型检查可以提供一个公共的方法。

@wood001
Copy link
Author

wood001 commented Oct 19, 2017

@WillemJiang
我读了下linuxcon-workshop-demo代码中应用层使用hystrixcommand来实现异步的例子。但是这个不是完全的异步,CSE的worker调用线程并没有释放,还是继续等待应用层的最后返回。

但是通过业务层接口增加hystrix注解简化应用层实现异步的能力确实是个很好的实践,我来考虑下结合hystrix注解实现真实的异步,同时consumer侧也真实支持异步能力。

稍后我会重新PR

@wood001 wood001 closed this Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants