parent
1128024797
commit
82c761f026
14 changed files with 109 additions and 117 deletions
|
|
@ -23,7 +23,6 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
|
|||
case class LogsOffer(streamId: Int, sourceRef: SourceRef[String])
|
||||
|
||||
class DataSource extends Actor {
|
||||
import context.dispatcher
|
||||
implicit val mat = ActorMaterializer()(context)
|
||||
|
||||
def receive = {
|
||||
|
|
@ -32,13 +31,13 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
|
|||
val source: Source[String, NotUsed] = streamLogs(streamId)
|
||||
|
||||
// materialize the SourceRef:
|
||||
val ref: Future[SourceRef[String]] = source.runWith(StreamRefs.sourceRef())
|
||||
val ref: SourceRef[String] = source.runWith(StreamRefs.sourceRef())
|
||||
|
||||
// wrap the SourceRef in some domain message, such that the sender knows what source it is
|
||||
val reply: Future[LogsOffer] = ref.map(LogsOffer(streamId, _))
|
||||
val reply = LogsOffer(streamId, ref)
|
||||
|
||||
// reply to sender
|
||||
reply.pipeTo(sender())
|
||||
sender() ! reply
|
||||
}
|
||||
|
||||
def streamLogs(streamId: Long): Source[String, NotUsed] = ???
|
||||
|
|
@ -70,7 +69,6 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
|
|||
|
||||
class DataReceiver extends Actor {
|
||||
|
||||
import context.dispatcher
|
||||
implicit val mat = ActorMaterializer()(context)
|
||||
|
||||
def receive = {
|
||||
|
|
@ -79,13 +77,13 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
|
|||
val sink: Sink[String, NotUsed] = logsSinkFor(nodeId)
|
||||
|
||||
// materialize the SinkRef (the remote is like a source of data for us):
|
||||
val ref: Future[SinkRef[String]] = StreamRefs.sinkRef[String]().to(sink).run()
|
||||
val ref: SinkRef[String] = StreamRefs.sinkRef[String]().to(sink).run()
|
||||
|
||||
// wrap the SinkRef in some domain message, such that the sender knows what source it is
|
||||
val reply: Future[MeasurementsSinkReady] = ref.map(MeasurementsSinkReady(nodeId, _))
|
||||
val reply = MeasurementsSinkReady(nodeId, ref)
|
||||
|
||||
// reply to sender
|
||||
reply.pipeTo(sender())
|
||||
sender() ! reply
|
||||
}
|
||||
|
||||
def logsSinkFor(nodeId: String): Sink[String, NotUsed] = ???
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue