As i understand your question what you need to do is:
steps
- End point to access some API via HTTP call.
- If the response is not coming within 1 second you need to get an exception.
- In the case of exception you need to restart the service and again send the request.
you can do that in collaboration of Akka Http and Akka Actors.
With the use of Akka actors you can tell your service what need to be done when you are getting TimeoutException. You can make your API call via Akka ask pattern.
If you will see the documnetation of Akka ask pattern here. it takes Akka ask timeout which you can set to any value you want, In case when you are not getting the response back in timeout you will get AkkaAskTimeOutException, which will be catched by your child actor and then it will be passed to the supervisor actor, While Supervisor actor catchs an exception we can use the supervison strategy and can specify what needs to be done Like (restart, shutdown, resume etc).
Supervison strategy: you can read about it here. Actually following is basic structure of an akka actor based application.
Supervisor Actor (we write supervison strategy in supervisor) and it has child actors.
child1(business logic) child2 (business logic)