Skip to content

Commit

Permalink
Fixed BlazeServerBuilder deprecation with using ExecutionContext expl…
Browse files Browse the repository at this point in the history
…icitly
  • Loading branch information
qqmbr4k committed May 27, 2020
1 parent 78f9452 commit 5bfd321
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import zio.interop.catz._
import zio.console.putStrLn
import zio.{App, ExitCode, ZEnv, ZIO}

import scala.concurrent.ExecutionContext

object SagaApp extends App {

import org.http4s.server.blaze._
Expand All @@ -25,7 +27,7 @@ object SagaApp extends App {
orderSEC <- OrderSagaCoordinatorImpl(paymentService, loyaltyPoints, orderService, logDao, sagaMaxReqTimeout)
app = new SagaEndpoint(orderSEC).service
_ <- orderSEC.recoverSagas.fork
_ <- BlazeServerBuilder[TaskC].bindHttp(8042).withHttpApp(app).serve.compile.drain
_ <- BlazeServerBuilder[TaskC](ExecutionContext.global).bindHttp(8042).withHttpApp(app).serve.compile.drain
} yield ()).foldM(
e => putStrLn(s"Saga Coordinator fails with error $e, stopping server...").as(ExitCode.failure),
_ => putStrLn(s"Saga Coordinator finished successfully, stopping server...").as(ExitCode.success)
Expand Down

0 comments on commit 5bfd321

Please sign in to comment.