Skip to content

Commit

Permalink
Merge pull request #616 from adzerk/pekko-support
Browse files Browse the repository at this point in the history
Add pekko subprojects
  • Loading branch information
dimamo5 authored Feb 19, 2024
2 parents 4271195 + 1864eb3 commit a95bb3b
Show file tree
Hide file tree
Showing 29 changed files with 1,418 additions and 54 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Please take into account that the library is still in an experimental stage and
- [ProgressBar](#progressbar)
- [Reflect](#reflect)
- [Retry](#retry)
- [Akka HTTP](#akka-http)
- [Akka HTTP/Pekko HTTP](#akka-http--pekko-http)
- [ClientIPDirectives](#clientipdirectives)
- [ExtraMiscDirectives](#extramiscdirectives)
- [ProxySupport](#proxysupport)
Expand Down Expand Up @@ -276,10 +276,12 @@ Retry.retry(10)(m())
// res21: util.Try[Int] = Success(value = 6)
```

## Akka HTTP
## Akka HTTP / Pekko HTTP

The `akka-http` module provides additional [directives](https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/index.html#directives) to be used in [akka-http](https://doc.akka.io/docs/akka-http/current/index.html).

The same features are provided for Pekko under the `pekko-http` module.

To use it in an existing SBT project, add the following dependency to your `build.sbt`:

```scala
Expand Down
15 changes: 7 additions & 8 deletions akka-http/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import Dependencies._

libraryDependencies ++= Seq(
ScalaLogging,
AkkaActor % Provided,
AkkaHttp % Provided,
AkkaHttpCore % Provided,
AkkaStream % Provided,
AkkaActor % Provided,
AkkaHttp % Provided,
AkkaHttpCore % Provided,
AkkaStream % Provided,
ScalaLogging,
TypesafeConfig,
AkkaActorTestkitTyped % Test,
AkkaHttpTestkit % Test,
AkkaTestkitSpecs2Classic % Test,
Specs2Core % Test
AkkaActorTestkitTyped % Test,
AkkaHttpTestkit % Test,
Specs2Core % Test
)
37 changes: 23 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ def module(project: Project, moduleName: String) =
.settings(name := s"apso-$moduleName")
.settings(commonSettings: _*)

lazy val akka = module(project, "akka")
lazy val akkaHttp = module(project, "akka-http").dependsOn(core % Test, testkit % Test)
lazy val aws = module(project, "aws").dependsOn(core)
lazy val caching = module(project, "caching").enablePlugins(BoilerplatePlugin)
lazy val circe = module(project, "circe")
lazy val collections = module(project, "collections")
lazy val core = module(project, "core").dependsOn(testkit % Test)
lazy val elasticsearch = module(project, "elasticsearch").dependsOn(testkit % Test)
lazy val encryption = module(project, "encryption")
lazy val hashing = module(project, "hashing")
lazy val io = module(project, "io").dependsOn(aws, testkit % Test)
lazy val profiling = module(project, "profiling")
lazy val testkit = module(project, "testkit")
lazy val time = module(project, "time")
lazy val akka = module(project, "akka")
lazy val akkaHttp = module(project, "akka-http").dependsOn(core % Test, testkit % Test)
lazy val aws = module(project, "aws").dependsOn(core)
lazy val caching = module(project, "caching").enablePlugins(BoilerplatePlugin)
lazy val circe = module(project, "circe")
lazy val collections = module(project, "collections")
lazy val core = module(project, "core").dependsOn(testkit % Test)
lazy val elasticsearch = module(project, "elasticsearch").dependsOn(testkit % Test)
lazy val elasticsearchPekko = module(project, "elasticsearch-pekko").dependsOn(testkit % Test)
lazy val encryption = module(project, "encryption")
lazy val hashing = module(project, "hashing")
lazy val io = module(project, "io").dependsOn(aws, testkit % Test)
lazy val pekko = module(project, "pekko")
lazy val pekkoHttp = module(project, "pekko-http").dependsOn(core % Test, testkit % Test)
lazy val profiling = module(project, "profiling")
lazy val testkit = module(project, "testkit")
lazy val time = module(project, "time")

lazy val apso = (project in file("."))
.settings(commonSettings: _*)
Expand All @@ -42,9 +45,12 @@ lazy val apso = (project in file("."))
collections,
core,
elasticsearch,
elasticsearchPekko,
encryption,
hashing,
io,
pekko,
pekkoHttp,
profiling,
time
)
Expand All @@ -57,9 +63,12 @@ lazy val apso = (project in file("."))
collections,
core,
elasticsearch,
elasticsearchPekko,
encryption,
hashing,
io,
pekko,
pekkoHttp,
profiling,
testkit,
time
Expand Down
1 change: 0 additions & 1 deletion caching/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "28.0-jre", // This wasn't updated due to incompatibility with scalacache-guava
ConcurrentLinkedHashMapLru,
ScalaCollectionCompat,
AkkaTestkitSpecs2Classic % Test,
Specs2Core % Test
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.Random

import net.ruippeixotog.akka.testkit.specs2.mutable.AkkaSpecification
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

class MemoizeFnWithGuavaSpec(implicit ee: ExecutionEnv) extends BaseMemoizeFnSpec()(ee) {
def newConf(size: Option[Long] = None, ttl: Option[FiniteDuration] = None) = {
Expand All @@ -23,7 +23,7 @@ class MemoizeFnWithCaffeineSpec(implicit ee: ExecutionEnv) extends BaseMemoizeFn
lazy val underlyingCacheName = "Caffeine"
}

abstract class BaseMemoizeFnSpec(implicit ee: ExecutionEnv) extends AkkaSpecification {
abstract class BaseMemoizeFnSpec(implicit ee: ExecutionEnv) extends Specification {

def newConf(size: Option[Long] = None, ttl: Option[FiniteDuration] = None): config.Cache
def underlyingCacheName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

package com.velocidi.apso.caching

import net.ruippeixotog.akka.testkit.specs2.mutable.AkkaSpecification
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

class SimpleLruCacheSpec(implicit ee: ExecutionEnv) extends AkkaSpecification {
import system.dispatcher

class SimpleLruCacheSpec(implicit ee: ExecutionEnv) extends Specification {
"not cache exceptions" in {
val cache = new SimpleLruCache[String](10, 10)
cache(1)((throw new RuntimeException("Naa")): String) must throwA[RuntimeException]("Naa").await
Expand Down
15 changes: 6 additions & 9 deletions core/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ libraryDependencies ++= Seq(
CirceCore,
ScalaCollectionCompat,
ScalaLogging,
TypesafeConfig % Provided,
TypesafeConfig % Provided,
UnirestJava,
AkkaHttpTestkit % Test,
AkkaStreamTestkit % Test,
AkkaTestkitSpecs2Classic % Test,
JUnit % Test,
ScalaCheck % Test,
Specs2Core % Test,
Specs2JUnit % Test,
Specs2ScalaCheck % Test
JUnit % Test,
ScalaCheck % Test,
Specs2Core % Test,
Specs2JUnit % Test,
Specs2ScalaCheck % Test
)
6 changes: 4 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Please take into account that the library is still in an experimental stage and
- [ProgressBar](#progressbar)
- [Reflect](#reflect)
- [Retry](#retry)
- [Akka HTTP](#akka-http)
- [Akka HTTP/Pekko HTTP](#akka-http--pekko-http)
- [ClientIPDirectives](#clientipdirectives)
- [ExtraMiscDirectives](#extramiscdirectives)
- [ProxySupport](#proxysupport)
Expand Down Expand Up @@ -259,10 +259,12 @@ def m() = {
Retry.retry(10)(m())
```

## Akka HTTP
## Akka HTTP / Pekko HTTP

The `akka-http` module provides additional [directives](https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/index.html#directives) to be used in [akka-http](https://doc.akka.io/docs/akka-http/current/index.html).

The same features are provided for Pekko under the `pekko-http` module.

To use it in an existing SBT project, add the following dependency to your `build.sbt`:

```scala
Expand Down
20 changes: 20 additions & 0 deletions elasticsearch-pekko/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Dependencies._

libraryDependencies ++= Seq(
PekkoActor % Provided,
ApacheHttpAsyncClient,
ApacheHttpClient,
ApacheHttpCore,
CirceCore,
Elastic4sClientEsJava,
Elastic4sCore,
ElasticsearchRestClient,
PekkoTestkit % Test,
PekkoHttpTestkit % Test,
PekkoSlf4J % Test,
Elastic4sTestkit % Test,
ElasticsearchClusterRunner % Test,
Log4JCore % Test,
Log4JSlf4j % Test,
Specs2Core % Test
)
3 changes: 3 additions & 0 deletions elasticsearch-pekko/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flush-prio-dispatcher {
mailbox-type = "org.apache.pekko.dispatch.UnboundedControlAwareMailbox"
}
Loading

0 comments on commit a95bb3b

Please sign in to comment.