These are chat archives for akkadotnet/AkkaStreams

28th
May 2018
Arjen Smits
@Danthar
May 28 2018 17:05
Anyone experience with the Zip operator? I want to do a simple
 Flow.Create<NotificationEnvelope>()
                .ConflateWithSeed(_ => 0, (i, _) => i + 1)
                .Zip(Source.Tick(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), NotUsed.Instance))
But the type system ain't having it.
I tried defining the Source.Tick differently. But it does not matter. Even when i reduce it to the simplest thing, it keeps complaining about not being able to infer types.
Marc Piechura
@marcpiechura
May 28 2018 17:25
@Danthar could you try 0 instead of NotUsed.Instance ?
Arjen Smits
@Danthar
May 28 2018 17:26
yeah tried that
gave a different error
hang on
Marc Piechura
@marcpiechura
May 28 2018 17:26
Another problem could be that they’ve different materialized values, I would put them in variables and checkt what the materialzed value is
Arjen Smits
@Danthar
May 28 2018 17:29
I dont know. looking at this. Its almost as if there is a missing definition somewhere
image.png
Marc Piechura
@marcpiechura
May 28 2018 17:32
So it’s the materialzed value, the flow has NotUsed while the Source.Tick has ICanceable but you can have only one
You can call MapMaterializedValue(_ => NotUsed.Instance) on the Source.Tick
That should do the trick
Arjen Smits
@Danthar
May 28 2018 17:34
heh. ok. ...
that makes perfect sense once you know it
Oddly enough though. this particular snippet comes up pretty often as an example for the jvm akka.streams
makes me wonder if we are missing something
Marc Piechura
@marcpiechura
May 28 2018 17:35
Probably some scala magic 😜
Can you link me to one of the examples?
Arjen Smits
@Danthar
May 28 2018 17:38
Im almost sure i found it in a blog somewhere as well. but this is the first one i run into. https://stackoverflow.com/questions/41980353/how-to-log-flow-rate-in-akka-stream?rq=1
But it might very well, be a bubble im in atm
Marc Piechura
@marcpiechura
May 28 2018 17:49
I think in scala they simply use the materialized value from Source.Tick
.via creates a flow which materialzed value is the one from the graph passed in, i.e. Source.Tick
Not sure if they’ve changed it recently or if it was always the case
Arjen Smits
@Danthar
May 28 2018 17:51
ah. well that makes sense
Marc Piechura
@marcpiechura
May 28 2018 17:52
Anyway as workaround MapMaterliazedValue or ZipMaterialzed will work
Arjen Smits
@Danthar
May 28 2018 17:52
yup
thx for the insight :)
Marc Piechura
@marcpiechura
May 28 2018 17:52
Np