laglangyue commented on issue #302:
URL: https://github.com/apache/pekko-grpc/issues/302#issuecomment-2065996365

   I think this FIXME may not be necessary, but there is a lot of repetitive 
code about GrpcResponseMetada, which can be constructed using a builder pattern 
to create GrpcResponseMetada, with Header, with Message, with Close (with 
Trailers)
   
   I have tried writing some code locally, but I still need some deeper 
exploration
   
   ```scala
   class GrpcResponseMetadataImpl(
       grpcHeaders: io.grpc.Metadata, trailersPromise: 
Promise[io.grpc.Metadata]) extends GrpcResponseMetadata {
   
     override def headers: pekko.grpc.scaladsl.Metadata =
       MetadataImpl.scalaMetadataFromGoogleGrpcMetadata(grpcHeaders)
     override def getHeaders(): pekko.grpc.javadsl.Metadata =
       MetadataImpl.javaMetadataFromGoogleGrpcMetadata(grpcHeaders)
     override def trailers: Future[pekko.grpc.scaladsl.Metadata] =
       
trailersPromise.future.map(MetadataImpl.scalaMetadataFromGoogleGrpcMetadata)(ExecutionContexts.parasitic)
     override def getTrailers(): CompletionStage[pekko.grpc.javadsl.Metadata] =
       
trailersPromise.future.map(MetadataImpl.javaMetadataFromGoogleGrpcMetadata)(ExecutionContexts.parasitic)
         .asJava
   }
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to