Skip to content

Commit

Permalink
fix more issues with legacy Akka naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed May 26, 2023
1 parent ec26c19 commit d7f291d
Show file tree
Hide file tree
Showing 31 changed files with 73 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: sbt -Dpekko.http.build.pekko.version=${{ matrix.PEKKO_VERSION }} ++${{ matrix.SCALA_VERSION }} Test/compile

- name: Run all tests JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}, Akka ${{ matrix.PEKKO_VERSION }}
run: sbt -Dpekko.http.parallelExecution=false -Dakka.test.timefactor=2 -Dpekko.http.build.pekko.version=${{ matrix.PEKKO_VERSION }} ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 -Dpekko.http.build.pekko.version=${{ matrix.PEKKO_VERSION }} ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test

- name: Upload test results
uses: actions/upload-artifact@v3 # upload test results
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ jobs:
# Quick testing for PR validation
- name: Validate pull request for JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'pull_request' }}
run: sbt -Dpekko.http.parallelExecution=false -Dakka.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} validatePullRequest
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} validatePullRequest

# Full testing for pushes
- name: Run all tests JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'push' }}
run: sbt -Dpekko.http.parallelExecution=false -Dakka.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test

- name: Upload test results
uses: actions/upload-artifact@v3 # upload test results
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ Pekko HTTP codebase is currently built with snapshot versions of the Pekko core

Since Pekko HTTP is released separately to Pekko "core", yet some features require changes in Pekko itself, it is sometimes very useful
to be able to develop Pekko HTTP with Pekko's sources used directly instead of the binary dependency. You can check out the Pekko
repository and run sbt with `-Dpekko.sources=$HOME/akka` to develop Pekko HTTP with Pekko as a source dependency instead of a binary one.
repository and run sbt with `-Dpekko.sources=$HOME/pekko` to develop Pekko HTTP with Pekko as a source dependency instead of a binary one.

This allows simple and fast iterations on changes that would need to be introduced in Pekko to develop a feature in HTTP that would require those.

## Binary compatibility
Binary compatibility rules and guarantees are described in depth in the [Binary Compatibility Rules
](https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html) section of the documentation.
](https://pekko.apache.org/docs/pekko/current/common/binary-compatibility-rules.html) section of the documentation.

Pekko HTTP uses MiMa (which is short for [Lightbend Migration Manager](https://github.com/lightbend/migration-manager)) to
validate binary compatibility of incoming Pull Requests. If your PR fails due to binary compatibility issues, you may see
Expand All @@ -153,7 +153,7 @@ Situations where it may be fine to ignore a MiMa issued warning include:
- if it is touching any class marked as `private[pekko]`, `/** INTERNAL API*/` or similar markers
- if it is concerning internal classes (often recognizable by package names like `dungeon`, `impl`, `internal` etc.)
- if it is adding API to classes / traits which are only meant for extension by Pekko itself, i.e. should not be extended by end-users
- if it is touching any class marked with the `@InternalApi`, `@DoNotInherit`, and `@ApiMayChange`. See [API stability annotations and comments](https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html#api-stability-annotations-and-comments)
- if it is touching any class marked with the `@InternalApi`, `@DoNotInherit`, and `@ApiMayChange`. See [API stability annotations and comments](https://pekko.apache.org/docs/pekko/current/common/binary-compatibility-rules.html#api-stability-annotations-and-comments)
- other tricky situations

If it turns out that the change can be safely ignored, please add the filter to a file with the issue number in the filename, placed in the submodule's `src/main/mima-filters/<last-released-version>.backwards.excludes` directory.
Expand Down Expand Up @@ -317,7 +317,7 @@ There is a number of ways timeouts can be defined in Pekko tests. The following

Special care should be given `expectNoMessage` calls, which indeed will wait the entire timeout before continuing, therefore a shorter timeout should be used in those, for example `200` or `300.millis`.

You can read up on remaining and friends in [TestKit.scala](https://github.com/apache/incubator-pekko/blob/main/akka-testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala)
You can read up on remaining and friends in [TestKit.scala](https://github.com/apache/incubator-pekko/blob/main/pekko-testkit/src/main/scala/org/apache/pekko/testkit/TestKit.scala)

# Supporting infrastructure

Expand Down Expand Up @@ -346,8 +346,8 @@ A great tool to inspect HTTP/2 frames of real-world connections is

When analyzing an HTTPS connection, you need a way to see the plaintext
payloads. You can enable logging those on the Pekko HTTP side with
`akka.http.server.log-unencrypted-network-bytes = 100` or
`akka.http.server.http2.log-frames = true` (same for client-side).
`pekko.http.server.log-unencrypted-network-bytes = 100` or
`pekko.http.server.http2.log-frames = true` (same for client-side).

To see the traffic in Wireshark, some clients can be configured to dump an
`SSLKEYLOGFILE` that Wireshark
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ lazy val compatibilityTests = Project("http-compatibility-tests", file("http-com
(Test / dependencyClasspath) := {
// HACK: We'd like to use `dependsOn(http % "test->compile")` to upgrade the explicit dependency above to the
// current version but that fails. So, this is a manual `dependsOn` which works as expected.
(Test / dependencyClasspath).value.filterNot(_.data.getName contains "akka") ++
(Test / dependencyClasspath).value.filterNot(_.data.getName contains "pekko") ++
(httpTests / Test / fullClasspath).value
}
)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/client-side/client-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Java
You can use @apidoc[ClientTransport.withCustomResolver](ClientTransport) to customize host name resolution. The given resolution function will be called for every connection attempt to resolve
a hostname / port combination (potentially asynchronously) to an `InetSocketAddress`.

As a backend to implement the resolution function you can use Apache Pekko's [Async DNS Resolution](https://doc.akka.io/docs/akka/current/io-dns.html#dns-extension).
As a backend to implement the resolution function you can use Apache Pekko's [Async DNS Resolution](https://pekko.apache.org/docs/pekko/current/io-dns.html#dns-extension).

Potential use cases:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/common/json-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Apache Pekko HTTP's @ref[marshalling](marshalling.md) and @ref[unmarshalling](unmarshalling.md) infrastructure makes it rather easy to seamlessly convert application-domain objects from and to JSON.
Integration with @scala[[spray-json]]@java[[Jackson]] is provided out of the box through the @scala[`pekko-http-spray-json`]@java[`pekko-http-jackson`] module.
Integration with other JSON libraries are supported by the community.
See [the list of current community extensions for Apache Pekko HTTP](https://akka.io/community/#extensions-to-akka-http).
See @ref[the list of current community extensions for Apache Pekko HTTP](../examples-and-extensions.md#extensions).

@@@ div { .group-java }

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/common/sse-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ Java
: @@snip [EventStreamMarshallingTest.java](/http-tests/src/test/java/org/apache/pekko/http/javadsl/unmarshalling/sse/EventStreamUnmarshallingTest.java) { #event-stream-unmarshalling-example }

Notice that if you are looking for a resilient way to permanently subscribe to an event stream,
Apache Pekko Connectors provides the [EventSource](https://doc.akka.io/docs/alpakka/current/sse.html)
Apache Pekko Connectors provides the [EventSource](https://pekko.apache.org/docs/pekko-connectors/current/sse.html)
connector which reconnects automatically with the id of the last seen event.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ provided dispatcher would be used. Both these dispatchers are ForkJoin pools by
not best suited for blocking operations.
@@@
For example, the above screenshot shows an Apache Pekko FJP dispatchers threads,
named "`default-akka.default-dispatcher2,3,4`" going into the blocking state, after having been idle.
It can be observed that the number of new threads increases, "`default-akka.actor.default-dispatcher 18,19,20,...`"
named "`default-pekko.default-dispatcher2,3,4`" going into the blocking state, after having been idle.
It can be observed that the number of new threads increases, "`default-pekko.actor.default-dispatcher 18,19,20,...`"
however they go to sleep state immediately, thus wasting the resources.
@java[The same happens to the global @javadoc[ForkJoinPool](java.util.concurrent.ForkJoinPool) when using Java Futures.]

Expand Down
2 changes: 2 additions & 0 deletions docs/src/main/paradox/release-notes/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 0. Release Notes

There are no Apache Pekko HTTP releases yet.

@@toc { depth=2 }

* [Akka HTTP releases](https://doc.akka.io/docs/akka-http/10.2/release-notes/index.html)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Creates a @scala[@scaladoc[Route](org.apache.pekko.http.scaladsl.server.index#Ro
that handles the request using a function or `PartialFunction` from @apidoc[HttpRequest] to a @scala[`Future`]@java[`CompletionStage`] of @apidoc[HttpResponse].

This directive can be used to include external components request processing components defined as a `Function` or `PartialFunction`
(like [those provided by akka-grpc](https://doc.akka.io/docs/akka-grpc/current/server/walkthrough.html#serving-multiple-services))
(like [those provided by pekko-grpc](https://pekko.apache.org/docs/pekko-grpc/current/server/walkthrough.html#serving-multiple-services))
into a routing tree defined by directives and routes.

For the `PartialFunction` variant, the given list of rejections will be used to reject the request with if the `PartialFunction` is not defined for a request. By default,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RouteDirectives

The @apidoc[RouteDirectives] have a special role in akka-http's routing DSL. Contrary to all other directives (except most
The @apidoc[RouteDirectives] have a special role in pekko-http's routing DSL. Contrary to all other directives (except most
@ref[FileAndResourceDirectives](../file-and-resource-directives/index.md)) they do not produce instances of type `Directive[L <: HList]` but rather "plain"
routes of type @scala[@scaladoc[Route](org.apache.pekko.http.scaladsl.server.index#Route=org.apache.pekko.http.scaladsl.server.RequestContext=%3Escala.concurrent.Future[org.apache.pekko.http.scaladsl.server.RouteResult])]@java[@javadoc[Route](org.apache.pekko.http.javadsl.server.Route)].
The reason is that the @apidoc[RouteDirectives] are not meant for wrapping an inner route (like most other directives, as
Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/paradox/routing-dsl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The project template in @scala[[Apache Pekko HTTP Quickstart for Scala](https://

If you have been using Play framework's routes file notation before this @ref[Play comparison](play-comparison.md) may help you to get started with Apache Pekko HTTP routing.

<a name="interaction-with-akka-typed">
<a name="interaction-with-pekko-typed">
## Interaction with Actors

The following example shows how to use Apache Pekko HTTP with Apache Pekko Actors.
Expand All @@ -73,7 +73,7 @@ First let's start by defining the @apidoc[Behavior] that will act as a repositor
strictly needed for our sample, but just to have an actual actor to interact with:

Scala
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #akka-typed-behavior }
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #pekko-typed-behavior }

Java
: @@snip [JobRepository.scala](/docs/src/test/java/docs/http/javadsl/JobRepository.java) { #behavior }
Expand All @@ -83,7 +83,7 @@ Java
Then, let's define the JSON marshaller and unmarshallers for the HTTP routes:

Scala
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #akka-typed-json }
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #pekko-typed-json }

@@@

Expand All @@ -94,15 +94,15 @@ that will communicate with the previously defined behavior
and handle all its possible responses:

Scala
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #akka-typed-route }
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #pekko-typed-route }

Java
: @@snip [JobRoutes.scala](/docs/src/test/java/docs/http/javadsl/JobRoutes.java) { #route }

Finally, we create a @apidoc[Behavior] that bootstraps the web server and use it as the root behavior of our actor system:

Scala
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #akka-typed-bootstrap }
: @@snip [HttpServerWithActorsSample.scala](/docs/src/test/scala/docs/http/scaladsl/HttpServerWithActorsSample.scala) { #pekko-typed-bootstrap }

Java
: @@snip [HttpServerWithActorsSample.java](/docs/src/test/java/docs/http/javadsl/HttpServerWithActorsSample.java) { #bootstrap }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void customRejectionResponse() {
final RejectionHandler rejectionHandler = RejectionHandler.defaultHandler()
.mapRejectionResponse(response -> {
if (response.entity() instanceof HttpEntity.Strict) {
// since all Akka default rejection responses are Strict this will handle all rejections
// since all Pekko default rejection responses are Strict this will handle all rejections
String message = ((HttpEntity.Strict) response.entity()).getData().utf8String()
.replaceAll("\"", "\\\"");
// we create a new copy the response in order to keep all headers and status code,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ public void testRespondWithDefaultHeader() {
public void testRespondWithHeaders() {
//#respondWithHeaders
final HttpHeader gonzo = RawHeader.create("Funky-Muppet", "gonzo");
final HttpHeader akka = Origin.create(HttpOrigin.parse("http://pekko.apache.org"));
final HttpHeader pekko = Origin.create(HttpOrigin.parse("http://pekko.apache.org"));

final Route route = path("foo", () ->
respondWithHeaders(Arrays.asList(gonzo, akka), () ->
respondWithHeaders(Arrays.asList(gonzo, pekko), () ->
complete("beep")
)
);
Expand All @@ -149,8 +149,8 @@ public void testRespondWithDefaultHeaders() {
//#respondWithDefaultHeaders
//custom headers
final RawHeader blippy = RawHeader.create("X-Fish-Name", "Blippy");
final HttpHeader akka = Origin.create(HttpOrigin.parse("http://pekko.apache.org"));
final List<HttpHeader> defaultHeaders = Arrays.asList(blippy, akka);
final HttpHeader pekko = Origin.create(HttpOrigin.parse("http://pekko.apache.org"));
final List<HttpHeader> defaultHeaders = Arrays.asList(blippy, pekko);
final RawHeader elTonno = RawHeader.create("X-Fish-Name", "El Tonno");

// format: OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class HttpClientExampleSpec extends AnyWordSpec with Matchers with CompileOnlySp
val processorFlow: Flow[Option[ExamplePerson], Int, NotUsed] =
Flow[Option[ExamplePerson]].map(_.map(_.name.length).getOrElse(0))

// Run and completely consume a single akka http request
// Run and completely consume a single pekko http request
def runRequest(req: HttpRequest): Future[Option[ExamplePerson]] =
Http()
.singleRequest(req)
Expand All @@ -127,7 +127,7 @@ class HttpClientExampleSpec extends AnyWordSpec with Matchers with CompileOnlySp
.map(parse)
}

// Run each akka http flow to completion, then continue processing. You'll want to tune the `parallelism`
// Run each pekko http flow to completion, then continue processing. You'll want to tune the `parallelism`
// parameter to mapAsync -- higher values will create more cpu and memory load which may or may not positively
// impact performance.
requests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package docs.http.scaladsl

object HttpServerWithActorsSample {

// #akka-typed-behavior
// #pekko-typed-behavior
import org.apache.pekko
import pekko.actor.typed.{ ActorRef, Behavior }
import pekko.actor.typed.scaladsl.Behaviors
Expand Down Expand Up @@ -57,9 +57,9 @@ object HttpServerWithActorsSample {
}

}
// #akka-typed-behavior
// #pekko-typed-behavior

// #akka-typed-json
// #pekko-typed-json
import org.apache.pekko.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import spray.json.DefaultJsonProtocol
import spray.json.DeserializationException
Expand Down Expand Up @@ -88,9 +88,9 @@ object HttpServerWithActorsSample {

implicit val jobFormat: RootJsonFormat[Job] = jsonFormat4(Job.apply)
}
// #akka-typed-json
// #pekko-typed-json

// #akka-typed-route
// #pekko-typed-route
import org.apache.pekko
import pekko.actor.typed.ActorSystem
import pekko.util.Timeout
Expand Down Expand Up @@ -145,9 +145,9 @@ object HttpServerWithActorsSample {
})
}
}
// #akka-typed-route
// #pekko-typed-route

// #akka-typed-bootstrap
// #pekko-typed-bootstrap
import org.apache.pekko
import pekko.actor.typed.PostStop
import pekko.http.scaladsl.Http.ServerBinding
Expand Down Expand Up @@ -214,5 +214,5 @@ object HttpServerWithActorsSample {
val system: ActorSystem[Server.Message] =
ActorSystem(Server("localhost", 8080), "BuildJobsServer")
}
// #akka-typed-bootstrap
// #pekko-typed-bootstrap
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class RejectionHandlerExamplesSpec extends RoutingSpec with CompileOnlySpec {
RejectionHandler.default
.mapRejectionResponse {
case res @ HttpResponse(_, _, ent: HttpEntity.Strict, _) =>
// since all Akka default rejection responses are Strict this will handle all rejections
// since all Pekko default rejection responses are Strict this will handle all rejections
val message = ent.data.utf8String.replaceAll("\"", """\"""")

// we copy the response in order to keep all headers and status code, wrapping the message as hand rolled JSON
Expand Down Expand Up @@ -147,7 +147,7 @@ class RejectionHandlerExamplesSpec extends RoutingSpec with CompileOnlySpec {
RejectionHandler.default
.mapRejectionResponse {
case res @ HttpResponse(_, _, ent: HttpEntity.Strict, _) =>
// since all Akka default rejection responses are Strict this will handle all rejections
// since all Pekko default rejection responses are Strict this will handle all rejections
val message = ent.data.utf8String.replaceAll("\"", """\"""")

// we copy the response in order to keep all headers and status code, wrapping the message as hand rolled JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* The base type for an Http message (request or response).
*
* INTERNAL API: this trait will be changed in binary-incompatible ways for classes that are derived from it!
* Do not implement this interface outside the Akka code base!
* Do not implement this interface outside the Pekko code base!
*
* Binary compatibility is only maintained for callers of this trait’s interface.
*/
Expand Down
Loading

0 comments on commit d7f291d

Please sign in to comment.