Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. ERROR i.a.g.application.actors.DbActor - GraphStage [akka.grpc.internal.AkkaNettyGrpcClientGraphStage$$anon$1@59d40805] terminated abruptly, caused by for example materializer or act
  2. akka.stream.AbruptStageTerminationException: GraphStage [akka.grpc.internal.AkkaNettyGrpcClientGraphStage$$anon$1@59d40805] terminated abruptly, caused by for example materializer or actor system termination.
  3.  
  4. ////////////////////server http binding /////////
  5. val service: HttpRequest => Future[HttpResponse] =
  6. ServiceOneServiceHandler(new ServiceOneServiceImpl(system))
  7.  
  8. val bound = Http().bindAndHandleAsync(
  9. service,
  10. interface = config.getString("akka.grpc.server.interface"),
  11. port = config.getString("akka.grpc.server.default-http-port").toInt,
  12. connectionContext = HttpConnectionContext(http2 = Always))
  13.  
  14. bound.foreach { binding =>
  15. logger.info(s"gRPC server bound to: ${binding.localAddress}")
  16. }
  17.  
  18. ////////////////////client /////////
  19. def send2Server[A](data: ListBuffer[A]): Future[ResponseDTO] = {
  20. val reply = {
  21.  
  22. val thisClient = interface.initialize()
  23. interface.call(client = thisClient, req = data.asInstanceOf[ListBuffer[StoreRequest]].toList)
  24.  
  25. }
  26. reply
  27. }
  28.  
  29. ///////////////// grpc communication //////////
  30. def send2GrpcServer[A](data: ListBuffer[A]): Unit = {
  31. val reply = send2Server(data)
  32. Await.ready(reply, Duration.Inf) onComplete {
  33. case util.Success(response: ResponseDTO) =>
  34. logger.info(s"got reply message: ${res.description}")
  35.  
  36. //////check response content and stop application if desired result not found in response
  37. }
  38. case util.Failure(exp) =>
  39. //////stop application
  40. throw exp.getCause
  41. }
  42.  
  43. Await.ready(reply, Duration.Inf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement