These are chat archives for akkadotnet/AkkaStreams

7th
Jul 2016
Konrad `ktoso` Malawski
@ktoso
Jul 07 2016 10:40
Hi all, figured I'd join here as well
Marc Piechura
@marcpiechura
Jul 07 2016 10:51
👍
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 13:40
So, I need you suggestions about streams on NetCore
I have three questions
1) Could we replace SystemException to just Exception?
2) What should we throw instead of ApplicationException?
3) What could we use instead of Thread.Yield?
details here
akkadotnet/akka.net#2134
We could use #IF NETCORE, but the best way is to have the same code on all platforms
Marc Piechura
@marcpiechura
Jul 07 2016 13:43
For 1 and 2 the question would be if we expect anywhere else in the code these exception types, I don't think so but I'm not sure, if not I see no reason why we shouldn't throw a normal exception instead.
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 13:51
In PCL and NetStandard all system (and application) exceptions inherit from Exception class, not from SystemException
We could easily change SystemException to Exception, while Streams in beta
Marc Piechura
@marcpiechura
Jul 07 2016 13:53
NullReferenceException looks appropriate, I mean that's the reason why we throw
alternatively maybe the custom IllegalStateException
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 13:54
Maybe InvalidOperationException ?
Marc Piechura
@marcpiechura
Jul 07 2016 13:57
Yep would also work
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 14:03
Ok
And the last question
What should we use instead of Thread.Yield?
Ms recommends to use System.Threading.SpinWait for spinning logic.
Marc Piechura
@marcpiechura
Jul 07 2016 14:05
I have no deep knowledge in that area, the only recommendation I found was that they want you to use Task.Yield instead, but not sure if this works in that case
@JeffCyr is the expert in these cases
so maybe he knows
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 14:16
Thank you. I will ask him
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:36
Kinda noobish question (especially from my side xD ) but I haven't found an example of attaching Source to BidiFlow in a way that would allow source accept reversed output of bidi flow. @Silv3rcircl3 have you found such of an example?
Marc Piechura
@marcpiechura
Jul 07 2016 14:41
Not sure I understand what you mean by "source accept reversed output of bidi flow"
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:41
wait a sec - time for some ASCII drawing ;)
this is bidi-flow:
       +------+       
I1 ~~> |      | ~O1~>
       | this |       
O2 <~~ |      | <~I2~ 
       +------+
owned
:D
Marc Piechura
@marcpiechura
Jul 07 2016 14:45
Yeah I mean I know what a bidi flow is :) but I don't understand how source should accept the O2 since it only has output port ;)
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:45
then we have a source:
+------+       
| this | ~O1~>
+------+
Marc Piechura
@marcpiechura
Jul 07 2016 14:46
ah there is coming more :)
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:47
so I'm thinking of a shape like that, but satisfying Source nature:
+------+       
|      | ~O1~>
| this |       
|      | <~I2~ 
+------+
precisely I'm thinking about confirm/abort/renew ACKs messages send from queues like Azure Service Bus
but I think, this part is necessary for things like TCP/HTTP communication too
Marc Piechura
@marcpiechura
Jul 07 2016 14:50
So O1 goes into I1 from the bidi and O2 from the bidi in I2?
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:51
yes
I haven't found a full source-to-sink example of bidi flows in akka-http, I think it may differ conceptually
Marc Piechura
@marcpiechura
Jul 07 2016 14:55
I see, so basically a source with an output and an input :-) sorry can't remember that I have seen something like this before
only thing that came me in mind would be a graph that takes a source and the bididlow and returns a sinkshape
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 14:57
I guess one way is to expose shape that has two endpoints, one for source and one for sink and bind them separatelly (or through helper method) to a bidi flow
Marc Piechura
@marcpiechura
Jul 07 2016 15:00
since we have him here, maybe @ktoso knows :)
Konrad `ktoso` Malawski
@ktoso
Jul 07 2016 15:00
could you summarise the question so I don't have to read the entire discussion?
the ascii art above is just a flow, isn't it
esp. in terms of ACKs, we have researched that area – it's modeled as Flows
see reactive-kafka for the API
and writeups on akka/akka-meta/issues
Bartosz Sypytkowski
@Horusiath
Jul 07 2016 15:01
ok, thanks
don't laught - perspective matters xD
+------+                                         +------+    
|      | ~O1~>                                   |      |
| this |          or maybe like ? ^^ ->    ~I2~> | this | ~O1~>   
|      | <~I2~                                   |      |
+------+                                         +------+
Konrad `ktoso` Malawski
@ktoso
Jul 07 2016 15:06
yeah hehe
I tend to think of them in terms of "number of inputs/outputs"
as the Flow shape ->[]-> is a bit limiting, one can do more interesting stuff than "map-like" with 2 ports (as you've just shown)
Alex Valuyskiy
@alexvaluyskiy
Jul 07 2016 21:08

NetCore version doesn't have Thread yield as we have here
https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Streams/Implementation/Fusing/ActorGraphInterpreter.cs#L277

I've looked at scala sources, and didn't find the same code. They've already changed it