The local address of the endpoint bound by the materialization of the connections
akka.stream.scaladsl.Source
The local address of the endpoint bound by the materialization of the connections
akka.stream.scaladsl.Source
Triggers "graceful" termination request being handled on this connection.
Triggers "graceful" termination request being handled on this connection.
Termination works as follows:
1) Unbind: - the server port is unbound; no new connections will be accepted.
1.5) Immediately the ServerBinding whenTerminationSignalIssued
future is completed.
This can be used to signal parts of the application that the http server is shutting down and they should clean up as well.
Note also that for more advanced shut down scenarios you may want to use the Coordinated Shutdown capabilities of Akka.
2) if a connection has no "in-flight" request, it is terminated immediately
3) Handle in-flight request:
- if a request is "in-flight" (being handled by user code), it is given hardDeadline
time to complete,
Connection: close
header and the connection is closed.4) Keep draining incoming requests on existing connection:
- The existing connection will remain alive for until the hardDeadline
is exceeded,
yet no new requests will be delivered to the user handler. All such drained responses will be replied to with an
termination response (as explained in phase 3).
5) Close still existing connections
- Connections are terminated forcefully once the hardDeadline
is exceeded.
The whenTerminated
future is completed as well, so the graceful termination (of the ActorSystem
or entire JVM
itself can be safely performed, as by then it is known that no connections remain alive to this server).
Note that the termination response is configurable in akka.http.javadsl.settings.ServerSettings, and by default is an 503 Service Unavailable
,
with an empty response entity.
timeout after which all requests and connections shall be forcefully terminated
future which completes successfully with a marker object once all connections have been terminated
Asynchronously triggers the unbinding of the port that was bound by the materialization of the connections
akka.stream.scaladsl.Source
Asynchronously triggers the unbinding of the port that was bound by the materialization of the connections
akka.stream.scaladsl.Source
Note that unbinding does NOT terminate existing connections. Unbinding only means that the server will not accept new connections, and existing connections are allowed to still perform request/response cycles. This can be useful when one wants to let clients finish whichever work they have remaining, while signalling them using some other way that the server will be terminating soon -- e.g. by sending such information in the still being sent out responses, such that the client can switch to a new server when it is ready.
Alternatively you may want to use the terminate method which unbinds and performs some level of gracefully replying with
The produced scala.concurrent.Future is fulfilled when the unbinding has been completed.
This future completes when the termination process, as initiated by an terminate call has completed.
This future completes when the termination process, as initiated by an terminate call has completed. This means that the server is by then: unbound, and has closed all existing connections.
This signal can for example be used to safely terminate the underlying ActorSystem.
Note: This mechanism is currently NOT hooked into the Coordinated Shutdown mechanisms of Akka. TODO: This feature request is tracked by: https://github.com/akka/akka-http/issues/1210
Note that this signal may be used for Coordinated Shutdown to proceed to next steps in the shutdown. You may also explicitly depend on this future to perform your next shutting down steps.
Completes when the terminate is called and server termination is in progress.
Completes when the terminate is called and server termination is in progress. Can be useful to make parts of your application aware that termination has been issued, and they have Deadline time remaining to clean-up before the server will forcefully close existing connections.
Note that while termination is in progress, no new connections will be accepted (i.e. termination implies prior unbind).
Represents a prospective HTTP server binding.
The local address of the endpoint bound by the materialization of the
connections
akka.stream.scaladsl.Source