Hi,
Is there a way to store a returned value of a flow and send it as parameter to the next restart of the source? this question is about how to save states in akka streams.
I’m reading a large file from a remote server using akka http get single request, and my purpose is:
- restart the source whenever the remote server crashed
- save a state in the flow(save the last successful byte that the flow consumed successfully) and send it to the source when restart.
This is my code for restart the source:
I would like to call the sendGetRequest with the state that I saved in parseAndIngestLargeFile(x)
RestartSource.withBackoff(minBackoff = 1 second, maxBackoff = 30 seconds,randomFactor = 0.2) { () =>
Source.single(sendGetRequest())
//send gakka http single request get to a remote server
.map(x => {parseAndIngestLargeFile(x)})
.map(connection => println(“Failed to connect to go server, going to retry get request…” + connection))
}
.runWith(Sink.ignore)
what is the way to do it?