Skip to content

Commit e159f4f

Browse files
chore(BACK-9362): switch from netty to ember
1 parent 564fc82 commit e159f4f

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

modules/core/src/main/scala/pillars/HttpServer.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.http4s.HttpVersion
1414
import org.http4s.Response
1515
import org.http4s.Status
1616
import org.http4s.circe.CirceEntityCodec.circeEntityEncoder
17-
import org.http4s.netty.server.NettyServerBuilder
17+
import org.http4s.ember.server.EmberServerBuilder
1818
import org.http4s.server.Server
1919
import org.http4s.server.middleware.CORS
2020
import org.http4s.server.middleware.ErrorHandling
@@ -94,11 +94,12 @@ object HttpServer:
9494

9595
val app: HttpApp[IO] = routes |> logging |> errorHandling |> cors
9696

97-
NettyServerBuilder[IO].withoutSsl.withNioTransport
98-
.bindHttp(config.port.value, config.host.toString)
97+
EmberServerBuilder
98+
.default[IO]
99+
.withHost(config.host)
100+
.withPort(config.port)
99101
.withHttpApp(app)
100-
.withoutBanner
101-
.resource
102+
.build
102103
end build
103104

104105
private def exceptionHandler(tracer: Tracer[IO]): ExceptionHandler[IO] =

modules/http-client/src/main/scala/pillars/httpclient/httpclient.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import org.http4s.Uri
2222
import org.http4s.client.Client
2323
import org.http4s.client.middleware.FollowRedirect
2424
import org.http4s.client.middleware.Logger
25+
import org.http4s.ember.client.EmberClientBuilder
2526
import org.http4s.headers.`User-Agent`
26-
import org.http4s.netty.client.NettyClientBuilder
2727
import pillars.Logging
2828
import pillars.Module
2929
import pillars.Modules
@@ -102,12 +102,10 @@ object HttpClient extends ModuleSupport:
102102
conf <- Resource.eval(reader.read[HttpClient.Config]("http-client"))
103103
metrics <- if conf.metrics then ClientMetrics(observability).map(_.middleware).toResource
104104
else Resource.pure(identity[Client[IO]])
105-
client <- NettyClientBuilder[IO]
106-
.withHttp2
107-
.withNioTransport
105+
client <- EmberClientBuilder.default[IO]
108106
.withUserAgent(conf.userAgent)
109-
.withMaxConnectionsPerKey(conf.maxConnections)
110-
.resource
107+
.withMaxPerKey(_ => conf.maxConnections)
108+
.build
111109
.map: client =>
112110
val logging =
113111
if conf.logging.enabled then

project/Dependencies.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ object versions {
1313
val fs2 = "3.12.0"
1414
val fs2Rabbit = "5.2.0"
1515
val http4s = "0.23.30"
16-
val http4sNetty = "0.5.23"
1716
val ip4s = "3.6.0"
1817
val iron = "2.6.0"
1918
val literally = "1.2.0"
@@ -70,12 +69,12 @@ object Dependencies {
7069
)
7170

7271
val http4sClient: Seq[ModuleID] = Seq(
73-
"org.http4s" %% "http4s-netty-client" % versions.http4sNetty,
72+
"org.http4s" %% "http4s-ember-client" % versions.http4s,
7473
"com.softwaremill.sttp.tapir" %% "tapir-http4s-client" % versions.tapir,
7574
"com.alejandrohdezma" %% "http4s-munit" % versions.munit.http4s % Test
7675
)
7776
val http4sServer: Seq[ModuleID] = Seq(
78-
"org.http4s" %% "http4s-netty-server" % versions.http4sNetty
77+
"org.http4s" %% "http4s-ember-server" % versions.http4s
7978
)
8079
val scodec: Seq[ModuleID] = Seq(
8180
"org.scodec" %% "scodec-bits" % versions.scodec.bits,

0 commit comments

Comments
 (0)