-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Adding preMaterialize operator for Source #23895 #24497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged. For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask! |
OK TO TEST |
PLS WHITELIST |
Test FAILed. |
a62f2ca
to
738f156
Compare
Missed an import in the docs test. Should be passing now. |
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor comments
public void sourcePreMaterialization() { | ||
//#source-prematerialization | ||
Source<String, ActorRef> matValuePoweredSource = | ||
Source.actorRef(Integer.MAX_VALUE, OverflowStrategy.fail()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite agree Integer.MAX_VALUE
is a reasonable buffer size ;)
Also, funky indentation here (and the lines below)
probe1.expectError().getMessage should ===("boom") | ||
probe2.expectError().getMessage should ===("boom") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add one test case for when materialization of the matVal powered source fails also (.mapMaterializedValue(_ => throw booom)
), mostly to document what happens.
738f156
to
a407b9d
Compare
Test PASSed. |
* that can be used to consume elements from the newly materialized Source. | ||
*/ | ||
def preMaterialize()(implicit materializer: Materializer): (Mat, ReprMat[Out, NotUsed]) = { | ||
val (mat, pub) = toMat(Sink.asPublisher(fanout = true))(Keep.both).run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good, let's keep it like that. Technically the end-user may want to decide that but let's not expose this decision until we actually go into implementing the real-thing, as then perhaps that would not be needed at all.
Refs #23895