pjfanning opened a new pull request, #877: URL: https://github.com/apache/pekko-grpc/pull/877
### Motivation [#818](https://github.com/apache/pekko-grpc/pull/818) added a `GrpcMarshalling.negotiatedWithMaxSize` entry point that takes a maximum inbound message size, and #747 proposes another `negotiate` variant for compression. One entry point per setting does not scale, and each new one also changes the generated handlers. This is a prototype of the consolidation asked for in #875, using `GrpcServerSettings` as the object that is passed in rather than a new `ServerHandlerContext`. ### Modification - `GrpcProtocol.negotiate` and `GrpcMarshalling.negotiated` (scaladsl and javadsl) take a `GrpcServerSettings` instead of an `Int`, as an overload of `negotiated` rather than under a separate name. `negotiatedWithMaxSize` is removed — it was `@InternalApi` and unreleased. - The settings-less forms delegate to the new overload with `GrpcServerSettings.defaults` (package-private, built from an empty `Config` so it carries the built-in values). - The Scala and Java handler templates resolve their settings once and pass them straight through, instead of unpacking `maxInboundMessageSize`. The generated `partial` signatures keep their existing `GrpcServerSettings` parameter, so the public surface and the docs from #818 are unchanged. - `JavaUnaryHandlerBenchmark` lets `T` be inferred: the javadsl overload does not resolve when a Scala caller applies an explicit type argument (`negotiated[JHttpResponse](req, lambda)` fails with "missing parameter type"). Ordinary Scala call sites and Java callers are unaffected — arity prunes the alternatives. ### Result Further server handler configuration is added to `GrpcServerSettings` rather than as another negotiate entry point and another generated-handler parameter. If #875 settles on a richer `ServerHandlerContext` (settings plus interceptors, `Metadata` attributes), swapping it in is a one-line change at each call site, since both entry points already take a single object. ### Tests - `sbt "runtime/testOnly org.apache.pekko.grpc.*"` — 174 passed, including the new `GrpcMarshallingNegotiationSpec`, which asserts the negotiated reader is bounded by the settings passed (both DSLs) and that the settings-less form still gets the 4 MiB default. It uses a frame the bounded settings reject and the default accepts, so it cannot pass on a hardcoded limit. - `sbt "runtime/mimaReportBinaryIssues"` — passed - `sbt "runtime/Test/compile" "benchmarks/Test/compile" "plugin-tester-scala/Test/compile" "plugin-tester-java/Test/compile" "interop-tests/Test/compile"` — passed - `sbt "++3.3.8 runtime/Test/compile" "++3.3.8 plugin-tester-scala/Test/compile" "++3.3.8 benchmarks/Test/compile"` — passed ### References Refs #875, Refs #818, Refs #747 -- 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]
