Search code examples
scalapostakkaakka-http

Scala shutwodn akka-htpp server with post method


Don't understand why I can't off akka-http server.

Have the next code:

   path("api" / "system" / "shutdown") {
     logger.warning("shutting down insights application")
     appLifecycle.shutdown()
     complete(JsObject(Map("status" -> JsString("shutting_down"))))
   }
 }

def shutdown(): Unit                         = actor ! Shutdown

As a result, I got the next message -> The requested resource could not be found inside chrome I also got next message inside terminal -> com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: java.io.StringReader@421ea4c0; line: 1, column: 1]

Any ideas?


Solution

  • First of all I think you should add a post directive, then you should either do:

    system.terminate()
    

    or:

    actor ! Kill // or PoisonPill