Retrying Lagom Client Stream

I’m currently using Lagom 1.5

I have a Scala based client that needs to connect to a Java Lagom Service, using a streaming endpoint.

The endpoint is defined similar to:

ServiceCall<Source<Command, ?>, Source<Event, ?>> monitorAndControl();

I’m designing a graph for the client that needs to appear relatively infallible from outside, toward that end, I’d like to wrap my monitorAndControl() in some sort of retry mechanism - ideally one that doesn’t require restarting the whole graph.

If this was Akka-HTTP I imagine I’d be able to do it with the standard RestartFlow, as it presents its connections as a Flow, but ServiceCall can only be used via invoke(Source<Command, ?>).

I’m at somewhat of a loss how to achieve something similar with the Lagom client, at least without bouncing across multiple actors and thread boundaries using two StreamRefs.

Ideally I want:

  • Seamless operation
    • Some commands may be lost if the connection goes down… that’s expected, it’s an unreliable interface to begin with.
  • Emit a special Event locally when the connection has been interupted (not yet reconnected)
  • Minimize hidden buffers

Any advice would be appreciated. At the moment I’m debating if I should just use Akka-HTTP directly, but I’d rather use the client interface.