I don't fully understand your question, Barys, but I think what you are asking is "I've got data from a database that I'd like to make available via a stream. When the stream is done consuming, I'd like to close this database connection".
You reference play.api.libs.iteratee.Enumerator.unfold, which is a synchronous method to pull data from a result-set. This runs against the mantra of akka-streams; blocking is something you generally tend to avoid. However, if blocking is unavoidable, or if you've already got the result-set in memory, you could just write wrap your source in an iterator, and then do this:
def getResulsAsIterator(/*...*/): Iterator[T]
Source(() => getResultsAsIterator(/* ...*/))
(since iterators are stateful, you must provide a function to generate a new instance of the iterator, since a given akka stream can be run multiple times)
(also, there may be some special thread-pooling behavior that play.api.libs.iteratee.Enumerator.unfold provides of which I'm not aware, that akka-stream doesn't, so my suggestion that a standard iterator is probably incorrect).
If your data is pulled asynchronously, an ActorSource is probably your best bet (although I think a custom GraphStage implementation would work, also, documentation is presently lacking). They're relatively simple to implement and reason about, and quite flexible in what you can do with them.
I recently wanted to stream results asynchronously from Cassandra, and implementing an ActorPublisher worked very well for it (in the case, I don't close the result set on termination / stream abort, because Cassandra does not require you to close your sources. Also, when my actorRef is initialized, the resultSet isn't yet ready, so I use the stash pattern to wait for the resultSet to be available, and then proceed emit the results.)
Tim