Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ERROR i.a.g.application.actors.DbActor - GraphStage [akka.grpc.internal.AkkaNettyGrpcClientGraphStage$$anon$1@59d40805] terminated abruptly, caused by for example materializer or act
- akka.stream.AbruptStageTerminationException: GraphStage [akka.grpc.internal.AkkaNettyGrpcClientGraphStage$$anon$1@59d40805] terminated abruptly, caused by for example materializer or actor system termination.
- ////////////////////server http binding /////////
- val service: HttpRequest => Future[HttpResponse] =
- ServiceOneServiceHandler(new ServiceOneServiceImpl(system))
- val bound = Http().bindAndHandleAsync(
- service,
- interface = config.getString("akka.grpc.server.interface"),
- port = config.getString("akka.grpc.server.default-http-port").toInt,
- connectionContext = HttpConnectionContext(http2 = Always))
- bound.foreach { binding =>
- logger.info(s"gRPC server bound to: ${binding.localAddress}")
- }
- ////////////////////client /////////
- def send2Server[A](data: ListBuffer[A]): Future[ResponseDTO] = {
- val reply = {
- val thisClient = interface.initialize()
- interface.call(client = thisClient, req = data.asInstanceOf[ListBuffer[StoreRequest]].toList)
- }
- reply
- }
- ///////////////// grpc communication //////////
- def send2GrpcServer[A](data: ListBuffer[A]): Unit = {
- val reply = send2Server(data)
- Await.ready(reply, Duration.Inf) onComplete {
- case util.Success(response: ResponseDTO) =>
- logger.info(s"got reply message: ${res.description}")
- //////check response content and stop application if desired result not found in response
- }
- case util.Failure(exp) =>
- //////stop application
- throw exp.getCause
- }
- Await.ready(reply, Duration.Inf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement