liveBook · Manning

RestartSource

As explained in Akka in Action, Second Edition

RestartSource is an Akka Streams source factory that recreates an upstream source after failure according to configured restart settings.

RestartSource is an Akka Streams source factory that recreates an upstream source after failure. Backoff and restart limits control how aggressively it retries. section 16.3.4

Recovering a streaming gRPC client

A LocatorService exposes an infinite stream of locations through server-streaming gRPC. Wrap the asynchronous client call in Source.futureSource, then pass it to RestartSource.withBackoff. The example waits 90 seconds while the service is stopped and restarted, allowing the consumer to continue after UNAVAILABLE failures.

How Akka in Action, Second Edition covers it

How deep it goes
Demonstrates source recreation, exponential-style backoff settings, restart limits, asynchronous construction, and observable failure output.
Examples
Uses a LocatorService that emits simulated vehicle locations and a client test that survives service shutdown and restart.
What it assumes
Assumes Akka Streams, asynchronous futures, generated gRPC clients, and protobuf service definitions.
What you can do after
Operate/configure an Akka Streams source to retry a future-created gRPC stream with bounded randomized backoff.
How it connects
Connects Akka Streams with RestartSettings, futures, Akka gRPC, protobuf, and server-streaming gRPC.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.