# Akka http client retry with restart

**URL:** <https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685>\
**Category:** Akka HTTP\
**Created:** [November 11, 2018, 9:07am UTC](https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685 "2018-11-11T09:07:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lielShraga](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@lielShraga](https://discuss.akka.io/u/lielShraga)\
**Post date:** [November 11, 2018, 9:07am UTC](https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685/1 "2018-11-11T09:07:30Z")

</div>

Hi,

I found in the official doc, that there is an option to retry the http single get request, via using the following api:

```auto
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?

```auto

```

---

<div class="post-metadata">

**Author:** ![sleepiejohn](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/sleepiejohn/32/583_2.png) [@sleepiejohn](https://discuss.akka.io/u/sleepiejohn)\
**Post date:** [November 11, 2018, 5:16pm UTC](https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685/2 "2018-11-11T17:16:58Z")

</div>

It says you need an implicit umarsheller for source type, basically an implementation of Unmarshaller that knows how to work with your type.  
Have a look at [this example](https://doc.akka.io/docs/akka-http/current/routing-dsl/source-streaming-support.html), seems close to what you may want.

---

<div class="post-metadata">

**Author:** ![raboof](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/raboof/32/2913_2.png) [@raboof](https://discuss.akka.io/u/raboof)\
**Post date:** [November 12, 2018, 8:30am UTC](https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685/3 "2018-11-12T08:30:18Z")

</div>

Which example did you use as a starting point?

I see some similar code at [https://doc.akka.io/docs/akka-http/current/sse-support.html#client-side-usage-unmarshalling](https://doc.akka.io/docs/akka-http/current/sse-support.html#client-side-usage-unmarshalling). There the code snippet also imports the unmarshallers for `ServerSentEvent`, which you might be missing.

Could you try with `import akka.http.scaladsl.unmarshalling.sse.EventStreamUnmarshalling._`?

---

<div class="post-metadata">

**Author:** ![lielShraga](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@lielShraga](https://discuss.akka.io/u/lielShraga)\
**Post date:** [November 12, 2018, 12:28pm UTC](https://discuss.akka.io/t/akka-http-client-retry-with-restart/2685/4 "2018-11-12T12:28:26Z")

</div>

yes now it’s compiling…thanks!
