You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Alanxtl (via GitHub)" <gi...@apache.org> on 2026/06/16 06:41:09 UTC

[I] Expose unary response headers and trailers in generated Triple client API [dubbo-go]

Alanxtl opened a new issue, #3429:
URL: https://github.com/apache/dubbo-go/issues/3429

   ## Background
   
   Dubbo-Go Triple runtime already has support for unary response metadata through `triple_protocol.Response`:
   
   ```go
   resp := triple_protocol.NewResponse(msg)
   resp.Header()
   resp.Trailer()
   ```
   
   The underlying Triple client path can receive response headers and trailers into this response wrapper.
   
   However, the current code generated by `protoc-gen-go-triple` exposes unary methods like this:
   
   ```go
   Greet(ctx context.Context, req *GreetRequest, opts ...client.CallOption) (*GreetResponse, error)
   ```
   
   The generated method only returns the business response message. The caller cannot access the underlying `triple_protocol.Response`, so there is no stable way to read unary response headers or trailers from generated clients.
   
   Streaming generated clients already expose this capability:
   
   ```go
   ResponseHeader() http.Header
   ResponseTrailer() http.Header
   ```
   
   So response metadata is available for streaming calls, but not for unary calls.
   
   ## Problem
   
   This makes Triple header/trailer usage incomplete for generated clients:
   
   - Client can send request metadata through Triple metadata APIs.
   - Server can set response headers/trailers in the runtime.
   - Streaming clients can read response headers/trailers.
   - Unary generated clients cannot read response headers/trailers.
   
   This also makes it hard to provide a complete sample for unary header/trailer usage in `dubbo-go-samples`.
   
   ## Expected Behavior
   
   Generated unary clients should expose a way to access response headers and trailers.
   
   Possible API directions:
   
   1. Add an optional call option that captures response metadata.
   2. Add a generated unary method variant that returns a response wrapper.
   3. Support passing a `triple_protocol.Response`-like object into generated unary calls.
   
   For example, an API shape similar to one of these would work:
   
   ```go
   resp, err := cli.Greet(ctx, req, client.WithResponseHeader(header), client.WithResponseTrailer(trailer))
   ```
   
   or:
   
   ```go
   resp, err := cli.GreetWithResponse(ctx, req)
   headers := resp.Header()
   trailers := resp.Trailer()
   msg := resp.Msg
   ```
   
   The exact API shape can follow Dubbo-Go's existing generated-code compatibility requirements.
   
   ## Why This Matters
   
   Issue #2422 asks for a complete Triple header/trailer usage pattern. Without unary response metadata access in generated clients, Dubbo-Go can only document complete response header/trailer readback for streaming calls.
   
   Exposing unary response metadata would make the generated Triple API consistent with the runtime capability and with streaming generated clients.
   


-- 
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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [feat] protoc-gen-go-triple: Expose unary response headers and trailers in generated Triple client API [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl closed issue #3429: [feat] protoc-gen-go-triple: Expose unary response headers and trailers in generated Triple client API
URL: https://github.com/apache/dubbo-go/issues/3429


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [feat] protoc-gen-go-triple: Expose unary response headers and trailers in generated Triple client API [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on issue #3429:
URL: https://github.com/apache/dubbo-go/issues/3429#issuecomment-4719016716

   > I would like to work on this , please assign to me
   
   sure


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [feat] protoc-gen-go-triple: Expose unary response headers and trailers in generated Triple client API [dubbo-go]

Posted by "Vanillaxi (via GitHub)" <gi...@apache.org>.
Vanillaxi commented on issue #3429:
URL: https://github.com/apache/dubbo-go/issues/3429#issuecomment-4718462627

   I would like to work on this ,  please assign to me


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [feat] protoc-gen-go-triple: Expose unary response headers and trailers in generated Triple client API [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on issue #3429:
URL: https://github.com/apache/dubbo-go/issues/3429#issuecomment-4750016968

   close via #3443


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org