I have a lagom project with
- ServiceA that returns a stream of items read from slick:
def getItems: ServiceCall[NotUsed, Source[Item, NotUsed]]
ServiceA is implemented as followed:
override def getItems: Source[Item, NotUsed] = ServiceCall{_ =>
// items.result are a from a slick table
Source.fromPublisher(db.stream(items.result))
}
- A play ServiceB that exposes an SSE:
myServiveA.getItems().map{ source =>
Ok.chunked(source.via(EventSource.flow)).as(ContentTypes.EVENT_STREAM)
}
The issue i am having is that i am receiving a new source about every 4 second in the play controller which is repeating elements on the UI side.