diff --git a/play-java-grpc-example/README.md b/play-java-grpc-example/README.md index a854707f5..ad144addc 100644 --- a/play-java-grpc-example/README.md +++ b/play-java-grpc-example/README.md @@ -4,7 +4,7 @@ This example is described in the [Play Java gRPC Example site](https://developer This is an example application that shows how to use Pekko gRPC to both expose and use gRPC services inside an Play application. -For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://developer.lightbend.com/docs/akka-grpc/current/ . +For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/. ## Sample license diff --git a/play-java-grpc-example/app/routers/HelloWorldRouter.java b/play-java-grpc-example/app/routers/HelloWorldRouter.java index 1b61a32cd..5544bed80 100644 --- a/play-java-grpc-example/app/routers/HelloWorldRouter.java +++ b/play-java-grpc-example/app/routers/HelloWorldRouter.java @@ -1,21 +1,20 @@ package routers; import org.apache.pekko.actor.ActorSystem; -import org.apache.pekko.stream.Materializer; import example.myapp.helloworld.grpc.HelloReply; import example.myapp.helloworld.grpc.HelloRequest; -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; +import javax.inject.Inject; +import javax.inject.Singleton; @Singleton public class HelloWorldRouter extends example.myapp.helloworld.grpc.AbstractGreeterServiceRouter { @Inject - public HelloWorldRouter(Materializer mat, ActorSystem system) { - super(mat, system); + public HelloWorldRouter(ActorSystem system) { + super(system); } @Override diff --git a/play-java-grpc-example/build.sbt b/play-java-grpc-example/build.sbt index f4afa62b0..d313eec1a 100644 --- a/play-java-grpc-example/build.sbt +++ b/play-java-grpc-example/build.sbt @@ -1,7 +1,7 @@ import play.core.PlayVersion.pekkoVersion import play.core.PlayVersion.pekkoHttpVersion -import play.grpc.gen.javadsl.{ PlayJavaClientCodeGenerator, PlayJavaServerCodeGenerator } -import com.typesafe.sbt.packager.docker.{ Cmd, CmdLike, DockerAlias, ExecCmd } +import play.grpc.gen.javadsl.{PlayJavaClientCodeGenerator, PlayJavaServerCodeGenerator} +import com.typesafe.sbt.packager.docker.{Cmd, CmdLike, DockerAlias, ExecCmd} import play.java.grpc.sample.BuildInfo name := "play-java-grpc-example" @@ -11,18 +11,18 @@ version := "1.0-SNAPSHOT" // build.sbt lazy val `play-java-grpc-example` = (project in file(".")) .enablePlugins(PlayJava) - .enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC + .enablePlugins(PekkoGrpcPlugin) // enables source generation for gRPC .enablePlugins(PlayPekkoHttp2Support) // enables serving HTTP/2 and gRPC // #grpc_play_plugins .settings( - akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java), + pekkoGrpcGeneratedLanguages := Seq(PekkoGrpc.Java), // #grpc_client_generators // build.sbt - akkaGrpcExtraGenerators += PlayJavaClientCodeGenerator, + pekkoGrpcExtraGenerators += PlayJavaClientCodeGenerator, // #grpc_client_generators // #grpc_server_generators // build.sbt - akkaGrpcExtraGenerators += PlayJavaServerCodeGenerator, + pekkoGrpcExtraGenerators += PlayJavaServerCodeGenerator, Test / javaOptions += "-Dtestserver.httpsport=9443", // #grpc_server_generators PlayKeys.devSettings ++= Seq( @@ -49,8 +49,9 @@ lazy val `play-java-grpc-example` = (project in file(".")) .settings( libraryDependencies ++= CompileDeps ++ TestDeps ) - + scalaVersion := "2.13.12" +crossScalaVersions := Seq("2.13.12", "3.3.1") scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked") javacOptions ++= List("-Xlint:unchecked", "-Xlint:deprecation") // Needed for ssl-config to create self signed certificated under Java 17 @@ -59,7 +60,7 @@ Test / javaOptions ++= List("--add-exports=java.base/sun.security.x509=ALL-UNNAM val CompileDeps = Seq( guice, javaWs, - "com.lightbend.play" %% "play-grpc-runtime" % BuildInfo.playGrpcVersion, + "org.playframework" %% "play-grpc-runtime" % BuildInfo.playGrpcVersion, "org.apache.pekko" %% "pekko-discovery" % pekkoVersion, "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion, "org.apache.pekko" %% "pekko-http-spray-json" % pekkoHttpVersion, @@ -69,7 +70,7 @@ val CompileDeps = Seq( val TestDeps = Seq( // used in tests - "com.lightbend.play" %% "play-grpc-testkit" % BuildInfo.playGrpcVersion % Test + "org.playframework" %% "play-grpc-testkit" % BuildInfo.playGrpcVersion % Test ) // Make verbose tests diff --git a/play-java-grpc-example/conf/application.conf b/play-java-grpc-example/conf/application.conf index 440e8ba6f..d4e4d45a7 100644 --- a/play-java-grpc-example/conf/application.conf +++ b/play-java-grpc-example/conf/application.conf @@ -24,7 +24,7 @@ play.http.secret.key = "default-value-used-locally-with-at-minimal-length" play.modules { # To enable Pekko gRPC clients to be @Injected # This Module is generated by the Pekko gRPC sbt plugin. See your `target/scala-2.12/src_managed` folder. - enabled += example.myapp.helloworld.grpc.AkkaGrpcClientModule + enabled += example.myapp.helloworld.grpc.PekkoGrpcClientModule disabled += "play.grpc.ClassicActorsystemProviderModule" } # #grpc_enable_client_module diff --git a/play-java-grpc-example/docs/src/main/paradox/code-details.md b/play-java-grpc-example/docs/src/main/paradox/code-details.md index 540ac52e4..d8d94847c 100644 --- a/play-java-grpc-example/docs/src/main/paradox/code-details.md +++ b/play-java-grpc-example/docs/src/main/paradox/code-details.md @@ -2,7 +2,7 @@ Adding gRPC support to a vanilla Play application requires a few steps: -### 1. `sbt-akka-grpc` +### 1. `sbt-pekko-grpc` Add the Pekko gRPC plugin on `project/plugins.sbt` @@ -12,13 +12,13 @@ and enable it on your project (in `build.sbt`): @@snip [build.sbt](../../../../build.sbt) { #grpc_play_plugins } -The `AkkaGrpcPlugin` locates the gRPC `.proto` files and generates source code from it. Remember to enable the plugin +The `PekkoGrpcPlugin` locates the gRPC `.proto` files and generates source code from it. Remember to enable the plugin in all the projects of your build that want to use it. Note how the `PlayPekkoHttp2Support` is also enabled. gRPC requires HTTP/2 transport and Play supports it only as an opt-in plugin. -### 2.a Serving (Akka) gRPC Services +### 2.a Serving (Pekko) gRPC Services Have a look at the `conf/routes` file where you'll notice how to embed a gRPC router within a normal play application. You can in fact mix normal Play routes with gRPC routers like this to offer a mixed service. You'll notice that we @@ -51,4 +51,4 @@ Which in turn allows us to inject clients to any of the services defined in our Since you may want to configure what service discovery or hardcoded location to use for each client, you may do so as well in `conf/application.conf`, though we will not dive into this here. Refer to the documentation on -[using Pekko Discovery for endpoint discovery](https://developer.lightbend.com/docs/akka-grpc/current/client/configuration.html#using-akka-discovery-for-endpoint-discovery) for more details. +[using Pekko Discovery for endpoint discovery](https://pekko.apache.org/docs/pekko-grpc/current/client/configuration.html#using-pekko-discovery-for-endpoint-discovery) for more details. diff --git a/play-java-grpc-example/docs/src/main/paradox/index.md b/play-java-grpc-example/docs/src/main/paradox/index.md index f70631bf4..bd3409f59 100644 --- a/play-java-grpc-example/docs/src/main/paradox/index.md +++ b/play-java-grpc-example/docs/src/main/paradox/index.md @@ -6,10 +6,10 @@ The [Play Framework](https://www.playframework.com/) combines productivity and p scalable web applications with Java and Scala. Play is developer friendly with a "just hit refresh" workflow and built-in testing support. With Play, applications scale predictably due to a stateless and non-blocking architecture. -[Akka gRPC](https://developer.lightbend.com/docs/akka-grpc/current/overview.html) is a toolkit for building streaming +[Pekko gRPC](https://pekko.apache.org/docs/pekko-grpc/current/) is a toolkit for building streaming gRPC servers and clients on top of Pekko Streams. -For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://developer.lightbend.com/docs/akka-grpc/current/. +For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/. ## Obtaining this example diff --git a/play-java-grpc-example/project/plugins.sbt b/play-java-grpc-example/project/plugins.sbt index 64a2221ea..cb7f977db 100644 --- a/play-java-grpc-example/project/plugins.sbt +++ b/play-java-grpc-example/project/plugins.sbt @@ -1,5 +1,5 @@ enablePlugins(BuildInfoPlugin) -val playGrpcV = "0.9.1" +val playGrpcV = "0.12.1" buildInfoKeys := Seq[BuildInfoKey]("playGrpcVersion" -> playGrpcV) buildInfoPackage := "play.java.grpc.sample" @@ -9,6 +9,6 @@ addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.5") // #grpc_sbt_plugin // project/plugins.sbt -addSbtPlugin("com.lightbend.akka.grpc" %% "sbt-akka-grpc" % "1.0.2") -libraryDependencies += "com.lightbend.play" %% "play-grpc-generators" % playGrpcV +addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.0.2") +libraryDependencies += "org.playframework" %% "play-grpc-generators" % playGrpcV // #grpc_sbt_plugin diff --git a/play-scala-grpc-example/README.md b/play-scala-grpc-example/README.md index ab5307f35..f2ddc829e 100644 --- a/play-scala-grpc-example/README.md +++ b/play-scala-grpc-example/README.md @@ -4,7 +4,7 @@ This example is described in the [Play Scala gRPC Example site](https://develope This is an example application that shows how to use Pekko gRPC to both expose and use gRPC services inside an Play application. -For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://developer.lightbend.com/docs/akka-grpc/current/ . +For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/. ## Sample license diff --git a/play-scala-grpc-example/build.sbt b/play-scala-grpc-example/build.sbt index 12b050eea..f9adbf480 100644 --- a/play-scala-grpc-example/build.sbt +++ b/play-scala-grpc-example/build.sbt @@ -12,18 +12,18 @@ version := "1.0-SNAPSHOT" // build.sbt lazy val `play-scala-grpc-example` = (project in file(".")) .enablePlugins(PlayScala) - .enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC + .enablePlugins(PekkoGrpcPlugin) // enables source generation for gRPC .enablePlugins(PlayPekkoHttp2Support) // enables serving HTTP/2 and gRPC // #grpc_play_plugins .settings( - akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala), + pekkoGrpcGeneratedLanguages := Seq(PekkoGrpc.Scala), // #grpc_client_generators // build.sbt - akkaGrpcExtraGenerators += PlayScalaClientCodeGenerator, + pekkoGrpcExtraGenerators += PlayScalaClientCodeGenerator, // #grpc_client_generators // #grpc_server_generators // build.sbt - akkaGrpcExtraGenerators += PlayScalaServerCodeGenerator, + pekkoGrpcExtraGenerators += PlayScalaServerCodeGenerator, Test / javaOptions += "-Dtestserver.httpsport=0", // #grpc_server_generators PlayKeys.devSettings ++= Seq( @@ -53,7 +53,7 @@ lazy val `play-scala-grpc-example` = (project in file(".")) val CompileDeps = Seq( guice, - "com.lightbend.play" %% "play-grpc-runtime" % BuildInfo.playGrpcVersion, + "org.playframework" %% "play-grpc-runtime" % BuildInfo.playGrpcVersion, "org.apache.pekko" %% "pekko-discovery" % pekkoVersion, "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion, "org.apache.pekko" %% "pekko-http-spray-json" % pekkoHttpVersion, @@ -63,14 +63,15 @@ val CompileDeps = Seq( val playVersion = play.core.PlayVersion.current val TestDeps = Seq( - "com.lightbend.play" %% "play-grpc-scalatest" % BuildInfo.playGrpcVersion % Test, - "com.lightbend.play" %% "play-grpc-specs2" % BuildInfo.playGrpcVersion % Test, + "org.playframework" %% "play-grpc-scalatest" % BuildInfo.playGrpcVersion % Test, + "org.playframework" %% "play-grpc-specs2" % BuildInfo.playGrpcVersion % Test, "org.playframework" %% "play-test" % playVersion % Test, "org.playframework" %% "play-specs2" % playVersion % Test, "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.0" % Test, ) scalaVersion := "2.13.12" +crossScalaVersions := Seq("2.13.12", "3.3.1") scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked") // Needed for ssl-config to create self signed certificated under Java 17 Test / javaOptions ++= List("--add-exports=java.base/sun.security.x509=ALL-UNNAMED") diff --git a/play-scala-grpc-example/conf/application.conf b/play-scala-grpc-example/conf/application.conf index 440e8ba6f..d4e4d45a7 100644 --- a/play-scala-grpc-example/conf/application.conf +++ b/play-scala-grpc-example/conf/application.conf @@ -24,7 +24,7 @@ play.http.secret.key = "default-value-used-locally-with-at-minimal-length" play.modules { # To enable Pekko gRPC clients to be @Injected # This Module is generated by the Pekko gRPC sbt plugin. See your `target/scala-2.12/src_managed` folder. - enabled += example.myapp.helloworld.grpc.AkkaGrpcClientModule + enabled += example.myapp.helloworld.grpc.PekkoGrpcClientModule disabled += "play.grpc.ClassicActorsystemProviderModule" } # #grpc_enable_client_module diff --git a/play-scala-grpc-example/docs/src/main/paradox/code-details.md b/play-scala-grpc-example/docs/src/main/paradox/code-details.md index f0286608c..5e865f5de 100644 --- a/play-scala-grpc-example/docs/src/main/paradox/code-details.md +++ b/play-scala-grpc-example/docs/src/main/paradox/code-details.md @@ -2,7 +2,7 @@ Adding gRPC support to a vanilla Play application requires a few steps: -### 1. `sbt-akka-grpc` +### 1. `sbt-pekko-grpc` Add the Pekko gRPC plugin on `project/plugins.sbt` @@ -12,13 +12,13 @@ and enable it on your project (in `build.sbt`): @@snip [build.sbt](../../../../build.sbt) { #grpc_play_plugins } -The `AkkaGrpcPlugin` locates the gRPC `.proto` files and generates source code from it. Remember to enable the plugin +The `PekkoGrpcPlugin` locates the gRPC `.proto` files and generates source code from it. Remember to enable the plugin in all the projects of your build that want to use it. Note how the `PlayPekkoHttp2Support` is also enabled. gRPC requires HTTP/2 transport and Play supports it only as an opt-in plugin. -### 2.a Serving (Akka) gRPC Services +### 2.a Serving (Pekko) gRPC Services Have a look at the `conf/routes` file where you'll notice how to embed a gRPC router within a normal play application. You can in fact mix normal Play routes with gRPC routers like this to offer a mixed service. You'll notice that we @@ -51,4 +51,4 @@ Which in turn allows us to inject clients to any of the services defined in our Since you may want to configure what service discovery or hardcoded location to use for each client, you may do so as well in `conf/application.conf`, though we will not dive into this here. Refer to the documentation on -[using Pekko Discovery for endpoint discovery](https://developer.lightbend.com/docs/akka-grpc/current/client/configuration.html#using-akka-discovery-for-endpoint-discovery) for more details. +[using Pekko Discovery for endpoint discovery](https://pekko.apache.org/docs/pekko-grpc/current/client/configuration.html#using-pekko-discovery-for-endpoint-discovery) for more details. diff --git a/play-scala-grpc-example/docs/src/main/paradox/index.md b/play-scala-grpc-example/docs/src/main/paradox/index.md index 29f15e9c5..a8260cedc 100644 --- a/play-scala-grpc-example/docs/src/main/paradox/index.md +++ b/play-scala-grpc-example/docs/src/main/paradox/index.md @@ -6,10 +6,10 @@ The [Play Framework](https://www.playframework.com/) combines productivity and p scalable web applications with Java and Scala. Play is developer friendly with a "just hit refresh" workflow and built-in testing support. With Play, applications scale predictably due to a stateless and non-blocking architecture. -[Akka gRPC](https://developer.lightbend.com/docs/akka-grpc/current/overview.html) is a toolkit for building streaming +[Pekko gRPC](https://pekko.apache.org/docs/pekko-grpc/current/) is a toolkit for building streaming gRPC servers and clients on top of Pekko Streams. -For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://developer.lightbend.com/docs/akka-grpc/current/. +For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/. ## Obtaining this example diff --git a/play-scala-grpc-example/project/plugins.sbt b/play-scala-grpc-example/project/plugins.sbt index 3e7a3a7de..36c9a491a 100644 --- a/play-scala-grpc-example/project/plugins.sbt +++ b/play-scala-grpc-example/project/plugins.sbt @@ -1,5 +1,5 @@ enablePlugins(BuildInfoPlugin) -val playGrpcV = "0.9.1" +val playGrpcV = "0.12.1" buildInfoKeys := Seq[BuildInfoKey]("playGrpcVersion" -> playGrpcV) buildInfoPackage := "play.scala.grpc.sample" @@ -10,6 +10,6 @@ addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.5") // #grpc_sbt_plugin // project/plugins.sbt -addSbtPlugin("com.lightbend.akka.grpc" %% "sbt-akka-grpc" % "1.0.2") -libraryDependencies += "com.lightbend.play" %% "play-grpc-generators" % playGrpcV +addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.0.2") +libraryDependencies += "org.playframework" %% "play-grpc-generators" % playGrpcV // #grpc_sbt_plugin diff --git a/play-scala-grpc-example/test/test/HelloScalaTestSpec.scala b/play-scala-grpc-example/test/test/HelloScalaTestSpec.scala index 7860760df..727f66014 100644 --- a/play-scala-grpc-example/test/test/HelloScalaTestSpec.scala +++ b/play-scala-grpc-example/test/test/HelloScalaTestSpec.scala @@ -38,7 +38,7 @@ class HelloScalaTestSpec extends PlaySpec with GuiceOneServerPerTest with Server .get().futureValue result.status must be(200) // Maybe should be a 426, see #396 } - "work with a gRPC client" in withGrpcClient[GreeterServiceClient] { client: GreeterServiceClient => + "work with a gRPC client" in withGrpcClient[GreeterServiceClient] { (client: GreeterServiceClient) => val reply = client.sayHello(HelloRequest("Alice")).futureValue reply.message must be("Hello, Alice!") } diff --git a/play-scala-grpc-example/test/test/HelloSpecs2Spec.scala b/play-scala-grpc-example/test/test/HelloSpecs2Spec.scala index 458927f4e..f82e77e56 100644 --- a/play-scala-grpc-example/test/test/HelloSpecs2Spec.scala +++ b/play-scala-grpc-example/test/test/HelloSpecs2Spec.scala @@ -45,7 +45,7 @@ class HelloSpecs2Spec extends ForServer with ServerGrpcClient with PlaySpecifica result.status must ===(200) } "work with a gRPC client" >> { implicit rs: RunningServer => - withGrpcClient[GreeterServiceClient] { client: GreeterServiceClient => + withGrpcClient[GreeterServiceClient] { (client: GreeterServiceClient) => val reply = await(client.sayHello(HelloRequest("Alice"))) reply.message must ===("Hello, Alice!") } diff --git a/test.sh b/test.sh index a6191f857..f247d03da 100755 --- a/test.sh +++ b/test.sh @@ -9,9 +9,7 @@ pushd play-java-dagger2-example && scripts/test-sbt && popd pushd play-java-ebean-example && scripts/test-sbt && popd pushd play-java-fileupload-example && scripts/test-sbt && popd pushd play-java-forms-example && scripts/test-sbt && popd -#if [ "$MATRIX_SCALA" != "3.x" ]; then -# pushd play-java-grpc-example && scripts/test-sbt && popd -#fi +pushd play-java-grpc-example && scripts/test-sbt && popd pushd play-java-hello-world-tutorial && scripts/test-sbt && popd pushd play-java-jpa-example && scripts/test-sbt && popd pushd play-java-rest-api-example && scripts/test-sbt && popd @@ -24,9 +22,7 @@ pushd play-scala-chatroom-example && scripts/test-sbt && popd pushd play-scala-compile-di-example && scripts/test-sbt && popd pushd play-scala-fileupload-example && scripts/test-sbt && popd pushd play-scala-forms-example && scripts/test-sbt && popd -#if [ "$MATRIX_SCALA" != "3.x" ]; then -# pushd play-scala-grpc-example && scripts/test-sbt && popd -#fi +pushd play-scala-grpc-example && scripts/test-sbt && popd pushd play-scala-hello-world-tutorial && scripts/test-sbt && popd if [ "$MATRIX_SCALA" != "3.x" ]; then pushd play-scala-isolated-slick-example && scripts/test-sbt && popd