system.terminate()
terminates the Akka system even if all the messages in the system are not processed.
Is there a way of shutting down the akka-system once all the actors in the system have processed all the messages in the mailbox?
I don't think there is anything built-in in Akka to do what you are looking for. If you need that kind of functionality, you would need to create some kind of 'inflight recorder' that keeps track of which messages were sent and received.
This approach might be problematic if you are in a distributed environment and also expensive. Maybe it's worth considering if your use case really needs that functionality or you can do something else.
You might want to look into 'at least once delivery' as an alternative.
gracefulStop
as described here: doc.akka.io/docs/akka/current/actors.html#graceful-stop – marstran