Eric Anderson於 2016年4月22日星期五 UTC+8下午10時30分29秒寫道:
>
> You can create a ServerInterceptor that can copy any cause message to the
> status.
>
> public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
> MethodDescriptor<ReqT, RespT> method,
> ServerCall<RespT> call,
> Metadata headers,
> ServerCallHandler<ReqT, RespT> next) {
> return new SimpleForwardingServerCall(
> next.startCall(method, call, headers)) {
> @Override
> public void close(Status status, String message) {
> if (status.getDescription() == null
> && status.getCause() != null) {
> status = status.withDescription(
> status.getCause().getMessage());
> }
> super.close(status, message):
> }
> };
> }
>
Hi , it seems the signature changed in 1.0.0
Is there a 1.0.0 version of ServerInterceptor (that translate the
underlaying Exception to String )
*private ServerInterceptor serverInterceptor = new ServerInterceptor() {
@Override public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
ServerCall<ReqT, RespT> serverCall, Metadata metadata,
ServerCallHandler<ReqT, RespT> next) { logger.info("intercept {}" ,
serverCall.getMethodDescriptor().getFullMethodName()); // how to replace the
following line ? return next.startCall(serverCall, metadata); }};*
How to replace the next.startCall() line ?
Thanks a lot !
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/f991a8d9-c4fe-40d6-82ae-b8d518a114bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.