Hi,
I found in the official doc, that there is an option to retry the http single get request, via using the following api:
import akka.http.scaladsl.unmarshalling.Unmarshal
object Main extends App {
import system.dispatcher
implicit val system = ActorSystem("app")
implicit val mat = ActorMaterializer()
val restartSource = RestartSource.withBackoff(
minBackoff = 3.seconds,
maxBackoff = 30.seconds,
randomFactor = 0.2 // adds 20% "noise" to vary the intervals slightly
) { () =>
// Create a source from a future of a source
Source.fromFutureSource {
// Make a single request with akka-http
Http().singleRequest(HttpRequest(
uri = "http://example.com/eventstream"))
// Unmarshall it as a source of server sent events
.flatMap(Unmarshal(_).to[Source[ServerSentEvent, NotUsed]])
}
}
}
when I’m trying to run it as is in my intellij I get the following error:
Error:(49, 33) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.Unmarshaller[akka.http.scaladsl.model.HttpResponse,akka.stream.scaladsl.Source[akka.http.scaladsl.model.sse.ServerSentEvent,akka.NotUsed]]
.flatMap(Unmarshal(_).to[Source[ServerSentEvent, NotUsed]])
Any idea?