Skip to content

Commit

Permalink
akka -> pekko
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz committed Sep 21, 2023
1 parent 2554c2a commit 00b243d
Show file tree
Hide file tree
Showing 36 changed files with 105 additions and 105 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ Note that there is a special case: when you are streaming the response, then you

```scala
import scala.concurrent.ExecutionContext
import akka.util.ByteString
import akka.stream.scaladsl.Source
import org.apache.pekko.util.ByteString
import org.apache.pekko.stream.scaladsl.Source
import play.api.libs.ws.StandaloneWSClient

def useWSStream(ws: StandaloneWSClient)(implicit ec: ExecutionContext) =
Expand Down Expand Up @@ -159,7 +159,7 @@ implicit val fooBodyReadable = BodyReadable[Foo] { response =>
or custom BodyWritable:

```scala
import akka.util.ByteString
import org.apache.pekko.util.ByteString
import play.api.libs.ws.{ BodyWritable, InMemoryBody }

implicit val writeableOf_Foo: BodyWritable[Foo] = {
Expand Down Expand Up @@ -234,15 +234,15 @@ You can also define your own custom `BodyWritable`:
```java
public class MyClient {
private BodyWritable<String> someOtherMethod(String string) {
akka.util.ByteString byteString = akka.util.ByteString.fromString(string);
org.apache.pekko.util.ByteString byteString = org.apache.pekko.util.ByteString.fromString(string);
return new DefaultBodyWritables.InMemoryBodyWritable(byteString, "text/plain");
}
}
```

## Instantiating a standalone client

The standalone client needs [Akka](http://akka.io/) to handle streaming data internally:
The standalone client needs [Pekko](https://pekko.apache.org/) to handle streaming data internally:

### Scala

Expand All @@ -251,8 +251,8 @@ In Scala, the way to call out to a web service and close down the client:
```scala
package playwsclient

import akka.actor.ActorSystem
import akka.stream._
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream._
import play.api.libs.ws._
import play.api.libs.ws.ahc._

Expand All @@ -263,7 +263,7 @@ object ScalaClient {
import scala.concurrent.ExecutionContext.Implicits._

def main(args: Array[String]): Unit = {
// Create Akka system for thread and streaming management
// Create Pekko system for thread and streaming management
implicit val system = ActorSystem()
system.registerOnTermination {
System.exit(0)
Expand Down Expand Up @@ -318,8 +318,8 @@ In Java the API is much the same:
```java
package playwsclient;

import akka.actor.ActorSystem;
import akka.stream.*;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.stream.*;
import com.typesafe.config.ConfigFactory;

import play.libs.ws.*;
Expand All @@ -330,7 +330,7 @@ public class JavaClient implements DefaultBodyReadables {
private final ActorSystem system;

public static void main(String[] args) {
// Set up Akka materializer to handle streaming
// Set up Pekko materializer to handle streaming
final String name = "wsclient";
ActorSystem system = ActorSystem.create(name);
system.registerOnTermination(() -> System.exit(0));
Expand Down Expand Up @@ -426,7 +426,7 @@ class CaffeineHttpCache extends Cache {
def close(): Unit = underlying.cleanUp()
}

def withCache(implicit m: akka.stream.Materializer): StandaloneAhcWSClient = {
def withCache(implicit m: org.apache.pekko.stream.Materializer): StandaloneAhcWSClient = {
implicit def ec = m.executionContext

val cache = new CaffeineHttpCache()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package play.api.libs.ws.ahc

import java.util.concurrent.TimeUnit

import akka.stream.Materializer
import org.apache.pekko.stream.Materializer
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole
import play.api.libs.ws.StandaloneWSRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

package play.libs.ws.ahc;

import akka.Done;
import akka.actor.ActorSystem;
import akka.stream.Materializer;
import akka.stream.javadsl.Sink;
import akka.stream.javadsl.Source;
import akka.util.ByteString;
import org.apache.pekko.Done;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.stream.Materializer;
import org.apache.pekko.stream.javadsl.Sink;
import org.apache.pekko.stream.javadsl.Source;
import org.apache.pekko.util.ByteString;

import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package play.libs.ws.ahc

import akka.stream.Materializer
import org.apache.pekko.stream.Materializer
import org.specs2.execute.Result
import play.api.libs.ws.ahc.AhcConfigBuilder
import play.api.libs.ws.ahc.AhcWSClientConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

package play

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import org.specs2.concurrent.ExecutionEnv
import org.specs2.specification.BeforeAfterAll

import scala.concurrent.duration._
import scala.concurrent.Await
import akka.stream.Materializer
import org.apache.pekko.stream.Materializer

import play.api.mvc.Handler
import play.api.mvc.RequestHeader
Expand All @@ -34,7 +34,7 @@ trait NettyServerProvider extends BeforeAfterAll {
lazy val testServerPort: Int = server.httpPort.getOrElse(sys.error("undefined port number"))
val defaultTimeout: FiniteDuration = 5.seconds

// Create Akka system for thread and streaming management
// Create Pekko system for thread and streaming management
implicit val system: ActorSystem = ActorSystem()
implicit val materializer: Materializer = Materializer.matFromSystem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package play.api.libs.ws.ahc

import akka.stream.scaladsl.Sink
import akka.util.ByteString
import org.apache.pekko.stream.scaladsl.Sink
import org.apache.pekko.util.ByteString
import org.specs2.concurrent.ExecutionEnv
import org.specs2.concurrent.FutureAwait
import org.specs2.execute.Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package play.api.libs.ws.ahc

import java.nio.charset.StandardCharsets

import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.util.ByteString
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.Materializer
import org.apache.pekko.util.ByteString
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package play.api.libs.ws.ahc

import akka.stream.Materializer
import org.apache.pekko.stream.Materializer
import org.specs2.execute.Result

trait StandaloneWSClientSupport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package play.api.libs.ws.ahc

import java.nio.charset.StandardCharsets

import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.util.ByteString
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.Materializer
import org.apache.pekko.util.ByteString
import org.specs2.matcher.MustMatchers
import org.specs2.mutable.Specification
import org.specs2.specification.AfterAll
Expand Down Expand Up @@ -46,7 +46,7 @@ class XMLRequestSpec extends Specification with AfterAll with MustMatchers {

override def bodyAsBytes: ByteString = ByteString.fromArray(byteArray)

override def bodyAsSource: akka.stream.scaladsl.Source[ByteString, _] = ???
override def bodyAsSource: org.apache.pekko.stream.scaladsl.Source[ByteString, _] = ???
}

"write an XML node" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package play.libs.ws.ahc

import akka.stream.javadsl.Sink
import akka.util.ByteString
import org.apache.pekko.stream.javadsl.Sink
import org.apache.pekko.util.ByteString
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.FutureMatchers
import org.specs2.mutable.Specification
Expand Down Expand Up @@ -53,7 +53,7 @@ class AhcWSClientSpec(implicit val executionEnv: ExecutionEnv)

"get successfully" in withClient() { client =>
def someOtherMethod(string: String) = {
new InMemoryBodyWritable(akka.util.ByteString.fromString(string), "text/plain")
new InMemoryBodyWritable(org.apache.pekko.util.ByteString.fromString(string), "text/plain")
}
client
.url(s"http://localhost:$testServerPort")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package play.libs.ws.ahc;

import akka.Done;
import akka.stream.Materializer;
import akka.stream.javadsl.Source;
import akka.util.ByteString;
import akka.util.ByteStringBuilder;
import org.apache.pekko.Done;
import org.apache.pekko.stream.Materializer;
import org.apache.pekko.stream.javadsl.Source;
import org.apache.pekko.util.ByteString;
import org.apache.pekko.util.ByteStringBuilder;
import com.typesafe.sslconfig.ssl.SystemConfiguration;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
Expand Down Expand Up @@ -146,7 +146,7 @@ public void onComplete() {
* A convenience method for creating a StandaloneAhcWSClient from configuration.
*
* @param ahcWSClientConfig the configuration object
* @param materializer an akka materializer
* @param materializer an pekko materializer
* @return a fully configured StandaloneAhcWSClient instance.
* @see #create(AhcWSClientConfig, AhcHttpCache, Materializer)
*/
Expand All @@ -163,7 +163,7 @@ public static StandaloneAhcWSClient create(AhcWSClientConfig ahcWSClientConfig,
*
* @param ahcWSClientConfig the configuration object
* @param cache if not null, will be used for HTTP response caching.
* @param materializer an akka materializer
* @param materializer an pekko materializer
* @return a fully configured StandaloneAhcWSClient instance.
*/
public static StandaloneAhcWSClient create(AhcWSClientConfig ahcWSClientConfig, AhcHttpCache cache, Materializer materializer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package play.libs.ws.ahc;

import akka.stream.Materializer;
import akka.stream.javadsl.AsPublisher;
import akka.stream.javadsl.Sink;
import akka.stream.javadsl.Source;
import akka.util.ByteString;
import org.apache.pekko.stream.Materializer;
import org.apache.pekko.stream.javadsl.AsPublisher;
import org.apache.pekko.stream.javadsl.Sink;
import org.apache.pekko.stream.javadsl.Source;
import org.apache.pekko.util.ByteString;
import org.reactivestreams.Publisher;
import play.api.libs.ws.ahc.FormUrlEncodedParser;
import play.libs.oauth.OAuth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package play.libs.ws.ahc;

import akka.util.ByteString;
import org.apache.pekko.util.ByteString;

import play.api.libs.ws.ahc.AhcWSUtils;
import play.libs.ws.BodyReadable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package play.libs.ws.ahc;

import akka.stream.javadsl.Source;
import akka.util.ByteString;
import org.apache.pekko.stream.javadsl.Source;
import org.apache.pekko.util.ByteString;
import org.reactivestreams.Publisher;
import play.api.libs.ws.ahc.AhcWSUtils;
import play.libs.ws.BodyReadable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package play.api.libs.ws.ahc

import akka.Done
import org.apache.pekko.Done
import javax.inject.Inject
import akka.stream.Materializer
import akka.stream.scaladsl.Source
import akka.util.ByteString
import org.apache.pekko.stream.Materializer
import org.apache.pekko.stream.scaladsl.Source
import org.apache.pekko.util.ByteString
import com.typesafe.sslconfig.ssl.SystemConfiguration
import org.reactivestreams.Publisher
import org.reactivestreams.Subscriber
Expand Down Expand Up @@ -194,7 +194,7 @@ object StandaloneAhcWSClient {
* {{{
* import play.api.libs.ws.ahc.StandaloneAhcWSClient
*
* def example(someUrl: String)(implicit m: akka.stream.Materializer) = {
* def example(someUrl: String)(implicit m: org.apache.pekko.stream.Materializer) = {
* implicit def ec = m.executionContext
*
* val client = StandaloneAhcWSClient()
Expand All @@ -209,7 +209,7 @@ object StandaloneAhcWSClient {
*
* @param config configuration settings
* @param httpCache if not null, will be used for HTTP response caching.
* @param materializer the akka materializer.
* @param materializer the pekko materializer.
*/
def apply(
config: AhcWSClientConfig = AhcWSClientConfigFactory.forConfig(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import java.net.URI
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets

import akka.stream.Materializer
import akka.stream.scaladsl.Sink
import org.apache.pekko.stream.Materializer
import org.apache.pekko.stream.scaladsl.Sink
import play.api.libs.ws.StandaloneWSRequest
import play.api.libs.ws._
import play.shaded.ahc.io.netty.buffer.Unpooled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package play.api.libs.ws.ahc

import akka.stream.scaladsl.Source
import akka.util.ByteString
import org.apache.pekko.stream.scaladsl.Source
import org.apache.pekko.util.ByteString
import play.api.libs.ws.DefaultBodyReadables
import play.api.libs.ws.StandaloneWSResponse
import play.api.libs.ws.WSCookie
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.reactivestreams.Subscriber
import org.reactivestreams.Subscription
import org.reactivestreams.Publisher
import play.shaded.ahc.io.netty.handler.codec.http.HttpHeaders
import akka.Done
import org.apache.pekko.Done
import play.shaded.ahc.org.asynchttpclient.AsyncHandler.State
import play.shaded.ahc.org.asynchttpclient._
import play.shaded.ahc.org.asynchttpclient.handler.StreamedAsyncHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package play.api.libs.ws.ahc

import akka.stream.scaladsl.Source
import akka.util.ByteString
import org.apache.pekko.stream.scaladsl.Source
import org.apache.pekko.util.ByteString
import org.reactivestreams.Publisher
import play.api.libs.ws.StandaloneWSResponse
import play.api.libs.ws.WSCookie
Expand All @@ -19,8 +19,8 @@ import play.shaded.ahc.org.asynchttpclient.HttpResponseBodyPart
* {{{
* import scala.concurrent.{ ExecutionContext, Future }
*
* import akka.util.ByteString
* import akka.stream.scaladsl.Source
* import org.apache.pekko.util.ByteString
* import org.apache.pekko.stream.scaladsl.Source
*
* import play.api.libs.ws.DefaultBodyReadables._
* import play.api.libs.ws.ahc.StandaloneAhcWSClient
Expand Down
Loading

0 comments on commit 00b243d

Please sign in to comment.