OutputTruncationException


(Mghildiy) #1

Hi,

My code is as following:

In API:

ServiceCall(NotUsed,Source<String,?>> getTime(int intervalMs);
pathCall("/api/getTime/:duration", this::getTime)

In implementation:

@Override
public ServerServiceCall<NotUsed, Source<String, ?>> getTime(int intervalMs){
return request -> {
System.out.println(“Time interval:”+ intervalMs);
Duration interval = Duration.ofMillis(intervalMs);
return completedFuture(Source.tick(interval, interval, Long.toString(System.currentTimeMillis())));
};
}

When I make call: http://localhost:9000/api/getTime/3000

I get error:

akka.http.impl.util.One2OneBidiFlow$OutputTruncationException: Inner flow was completed without producing result elements for 1 outstanding elements
at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)

What causes such an issue?


(Mghildiy) #2

Hi,

Any input would be appreciated here.

With regards


(Alan Klikic) #3

@mghildiy
what version of lagom are you using?
It is akka http specific error.
Maybe the problem is with Source.tick (personally did not use it).
Can you maybe try using Source.repeat(“test”)?


(Mghildiy) #4

Hi,

Thanks for input.

Would try it.


(Yanick Salzmann) #5

I was running into a similar issue:

Maybe this is related to your issue as well?