Comments (6)
I like the general idea of exposing the materialized value as FS2 stream instead of providing a callback (which makes composition on FS2 side hard or impossible). But for better symmetry with Akka Sink|Source|Flow plus materialized value what do you think about adding converters like toSinkMat
, toSourceMat
and toPipeMat
returning a tuple containing the converted Sink|Stream|Pipe plus a Stream that emits the single materialized value. For example (in pseudocode):
val (fs2Sink, fs2MatStream) = akkaSink.toSinkMat()
val (fs2Source, fs2MatStream) = akkaSource.toSourceMat()
...
This would allow applications to compose the result tuple elements as they like in FS2. Also, when converting an Akka Source to an FS2 Stream, the Stream element type and the materialized value type usually differ and cannot be combined into a single Stream (unless you use something like Either[A,B]
as element type but this has less symmetry to Akka Streams).
The onMaterialization
parameter of existing converters toSink
, toStream
and toPipe
could then be removed/deprecated. WDYT?
from streamz.
That's not a bad idea - we can have toFoo(implicit ev: Mat =:= NotUsed)
and toFooMat
returning the tuple. That sounds like a nice interface!
from streamz.
Sounds good, would be great to see a PR! I'm not sure if toFoo(implicit ev: Mat =:= NotUsed)
is too restrictive but we can discuss that in the PR later. Thanks for your useful proposal!
from streamz.
I don't think it's too bad - If there's a used Mat
value, I think discarding it should be done explicitly, hence the Discard
constant that I'd put in the package object to be imported with the implicits
from streamz.
I have a WIP proposal here: master...Daenyth:matvalue
I'm playing around a bit to see if I can keep the single method name next, while still having the differing return types based on Mat
from streamz.
I don't think it's too bad - If there's a used
Mat
value, I think discarding it should be done explicitly, hence theDiscard
constant that I'd put in the package object to be imported with the implicits
Understood. If discarding can be done explicitly than it's fine. I thought users are forced to use toFooMat
then. So please ignore my previous concern then.
from streamz.
Related Issues (20)
- `null` in `receiveBody` from AWS-KINESIS HOT 4
- Builds for Scala 2.13 (-M5) in Central Maven Repo HOT 8
- Conversion from `fs2.Stream` to Akka `Source` Requires `ContextShift[IO]` HOT 2
- Upgrade to fs2 2.0
- Unable to import library HOT 5
- Unable to import library HOT 1
- Unable to import library HOT 1
- Flapping test: EndpointConsumerReplierSpec HOT 1
- Fix README Documentation section links for 0.11 release
- Set up MiMa bincompat checks
- Remove support for AkkaCamel since it is removed in Akka 2.6 HOT 1
- Camel 3 Support HOT 1
- Set up sbt-bintray
- 0.13-RC1, RC2: `AkkaSinkDsl#toPipe` method has an unsound cast
- Redesign API to have a `Converter[F]` type HOT 1
- Cats-effect 3.x roadmap
- Are Scala 2.13 versions published anywhere? HOT 2
- Migrate from Bintray HOT 14
- 0.12 JAR not present on bintray HOT 1
- Why does Keep.none affect materialized (CE3 branch)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamz.