gitcome commented on issue #106:
URL: 
https://github.com/apache/apisix-go-plugin-runner/issues/106#issuecomment-1255003962

   > If you want to use the grpc client to access APISIX, you need to enable 
the 
[grpc-transcode](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/grpc-transcode.md)
 plugin.
   > 
   > `"scheme": "grpc"` in upstream configures the protocol for accessing 
upstream to be `grpc`.
   
   my call chain like this:
                                                              1.[RequestFilter 
return] --?--> GrpcClient (report error)
   GrpcClient --grpc--> Apisix --?--> Go-plugin-runner(ext-plugin-post-req)  
                                                              2.[RequestFilter 
continue] --grpc--> GrpcServer --grpc--> Apisix --grpc--> GrpcClient(ok)
   
   in Go-plugin-runner, func RequestFilter like this:
   ```
   func (p *Say) RequestFilter(conf interface{}, w http.ResponseWriter, r 
pkgHTTP.Request) {
        w.Header().Set("Content-Type", r.Header().Get("Content-Type"))
        num := rand.Int()
        if num%2 == 1 {
                w.WriteHeader(http.StatusOK)
                w.Header().Set("mykey", "test")
                w.Header().Set("Grpc-Status", "0")
                w.Header().Set("Grpc-Message", "ok")
                w.Header().Set("Grpc-Status-Details-Bin", "")
                return   // here retrun to GrpcClient, is above chain 1, client 
report "server closed the stream without sending trailers"
        }
           return // here continue to GrpcServer then return to GrpcClient, is 
above chain 2, ok
   }
   ```
   
   above not use grpc-transcode,grpc-transcode ot suitable for our scene。Please 
have a look and help, thanks a lot!


-- 
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]

Reply via email to