Skip to content

Conversation

@timw
Copy link
Contributor

@timw timw commented Jan 29, 2026

This adds pekko-http directives that detect grpc/grpc-web requests.

This support integration of grpc endpoints alongside other HTTP requests on the same server binding (e.g. HTTP based /healthz handlers etc.) and different handling for different protocol types (e.g. enforcing Strict-Transport-Security for grpc-web requests).

Java and Scala DSLs are provided.
Currently the Java DSL uses the @InternalApi RouteHandler from pekk-http - this could be copied in-tree if that's not considered maintainable.

The GrpcProtocol.detect hasn't been used, as it doesn't check the main type of the MediaType at present - alternatively that could be changed and used for this purpose as well.

@timw
Copy link
Contributor Author

timw commented Jan 29, 2026

Looks like some scalafmt problems - something up with the IntelliJ scalafmt execution perhaps.

pekko-http directives that detect grpc/grpc-web requests.
This support integration of grpc endpoints alongside other HTTP requests on the same server binding (e.g. HTTP based /healthz handlers etc.).
@pjfanning
Copy link
Member

@timw could you add javadoc with @since 2.0.0 to the new public methods.
Is there a way some test coverage could be added?

@timw
Copy link
Contributor Author

timw commented Jan 29, 2026

@timw could you add javadoc with @since 2.0.0 to the new public methods.

Done.

Is there a way some test coverage could be added?

There's a spec for the scaladsl directives there already - do we want coverage of the javadsl as well?


package org.apache.pekko.grpc.scaladsl

import org.apache.pekko
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move keep the pekko imports together?

@raboof
Copy link
Member

raboof commented Feb 8, 2026

It's not super obvious what use cases this should cover. We already have some examples of Pekko HTTP integrations documented at https://pekko.apache.org/docs/pekko-grpc/current/server/pekko-http.html - perhaps it would be good to add some examples of typical use cases for this API to that page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants