Would something like the following in the server handler do it for you?...
def silentSource = ??? // Source that emits nothing but does never
completes
def handleDataFromClient: ByteString => Unit = ???
ForeachSink[StreamTcp.IncomingConnection] { conn =>
println("Client connec
Excellent, Björn. Thanks for that.
For what it's worth, I have created a source implementation using
KeyedActorSource - a very simple silent, non completing but cancellable source
so that we can keep TCP streams open without writing to them until we're done.
(For the moment I have put it in a p
Is there any way at the moment to create custom sources with specific
custom materializations?
Essentially we want to be able to create custom flexible scheduling Sources
(similar to TickSource) that materialize to Cancellable so that we can stop
them.
I can see how to create an ActorPublisher
Martynas,
No. I hadn't seen that.
That makes sense and provides flexibility: cancellation being specific to
Sources (or Sinks, I suppose?) that materialize to Cancellable (or
something providing an equivalent facility).
This probably caters for many sources for output data we will use (usually
complete when one of its input branches does.)
Any advice/pointers would be greatly appreciated.
Thanks,
Jeremy Stone
object SourceUtils {
def cancellable[T](source: Source[T])(implicit system: ActorSystem):
(Source[T], Cancellable) = {
val (inf, cancellable) = cancellableInfiniteSource