These are chat archives for akkadotnet/AkkaStreams

22nd
Sep 2018
Vasily Kirichenko
@vasily-kirichenko
Sep 22 2018 05:45
@thomaslazar you need to wait until your stream terminated, it seems the app exits too early.
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 05:53
@vasily-kirichenko sounds like he could use the example you send me?
Or my example as he is using a sourceactor
Thomas Lazar
@thomaslazar
Sep 22 2018 08:48
I'll take any and all examples :smile:
But I put that Console.Read() at the end of the loop so the application wouldn't terminate. And no amount of waiting makes a difference. But it was late last night when I played around with it. Might've missed something.
Vasily Kirichenko
@vasily-kirichenko
Sep 22 2018 08:49
Turn on debug logging and add .Log("source") after the source and all stages to watch elements flown.
akka {
    loglevel = "DEBUG"
 }
Thomas Lazar
@thomaslazar
Sep 22 2018 09:57
will try that. thanks
Thomas Lazar
@thomaslazar
Sep 22 2018 10:05
added the log to the source and the flow... not sure how to add it to the sink... but the messages show me that all 1000 messages get emitted from the source and at least pass through the flow. but in the end in the file i still only get 868 lines...
forgot to mention. is a .netcore21 project and i'm running it on mac if that's of any relevance
and if i only write out the timestamp i end up 819 lines and a garbeled 820
and just writing out the int i get 841 lines... ok. something is very weird here.
Thomas Lazar
@thomaslazar
Sep 22 2018 10:11
i also added a thread.sleep(5000-10000) after the loop to make sure it gets enough time to write down the data... doesn't make a difference
Vasily Kirichenko
@vasily-kirichenko
Sep 22 2018 14:50
@thomaslazar try overflow strategy = backpressure
Thomas Lazar
@thomaslazar
Sep 22 2018 19:11

@vasily-kirichenko
Unhandled Exception: System.NotSupportedException: Backpressure overflow strategy is not supported

That's not supported for Actor sources.

and it's also not failing. i had it fail when i had the buffer too small (100) and tried to send 1000 items to it.
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 19:17
@thomaslazar You could check out the example from september 18; 14:30. It has the termination watcher in there, making sure the graph is closed after the final element is passed through. Maybe write to console, before file. If you have that working go to file.
Thomas Lazar
@thomaslazar
Sep 22 2018 21:05
ok... stupid question... if i do a .Tell(new Status.Success("done")); to the source actor after the loop everything gets written to the file... but i have no clue what that actually means/entails. does it kill the source actor afterwards?
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 21:06
Status.Success is a "magic" object to stop a streamsactor
I know it's somewhere in the docs
I just forgot where it is
it works the same in newer dotnet versions
Thomas Lazar
@thomaslazar
Sep 22 2018 21:09
ok. i don't really want to do that though. idea is i have a device that i read out data from via bluetooth serial and i want to send that data to that source actor via remoting. and that source actor should just stay around as long as the server bit is running. but if not all data ends up in that sink while stuff is running... that's not so nice... i'm probably doing something completely wrong here.
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 21:10
close the stream just before you end the service I guess, and wait for the termination, before closing the system
Thomas Lazar
@thomaslazar
Sep 22 2018 21:29
you know what's interesting? i just built a Sink.ForEach<ByteString>(Console.WriteLine) and that just puts out all the values to console. i'm very... confused
Thomas Lazar
@thomaslazar
Sep 22 2018 21:43
i need to build a graph that writes out the raw data to file and also sends it off to be processed at another stage anyways. will see if i still have the problem of not having everything end up in the file then.
but not tonight. is almost midnight and my brain's going blergh just now
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 21:45
File io is slow, maybe the flush of the isn't done before killing the stream.
Thomas Lazar
@thomaslazar
Sep 22 2018 21:59
the thing is... i'm not killing the stream. at least not consciously.
just tried it. after the readkey i just send another 500 messages to that source actor and suddenly the rest of the first loop lands in the file and then the second loop only gets 300 odd lines written.
oh well... will look into that tomorrow.
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 22:12
Is it possible, there is a file buffer that needs to be flushed evevry now and then....
AndreSteenbergen
@AndreSteenbergen
Sep 22 2018 22:21
Streaming data from a file is as easy as creating a FileIO.FromFile given a target file, and an optional chunkSize which determines the buffer size determined as one "element" in such stream:
Streaming data from a file is as easy as creating a FileIO.FromFile given a target file, and an optional chunkSize which determines the buffer size determined as one "element" in such stream:
So there is a buffer, maybe a flush can given?