Skip to content
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

stream-testkit: issue with scala 2.12 usage of expectNextWithTimeoutPF #1393

Open
pjfanning opened this issue Jul 12, 2024 · 9 comments
Open

Comments

@pjfanning
Copy link
Contributor

pjfanning commented Jul 12, 2024

see apache/pekko-persistence-cassandra#212
there change that seems to have caused the issue is #1218 (and earlier #1186)

@pjfanning
Copy link
Contributor Author

@He-Pin what do you think we should do here? Should we document the issue we see in apache/pekko-persistence-cassandra#212 or is there a change we can make to stream-testkit to avoid the issue going forward?

@He-Pin
Copy link
Member

He-Pin commented Jul 12, 2024

I was expected to avoid a double evaluation, but that can only be done with 2.13, we may better go with 2.13 abd I expect drop the 2.12 support in 1.2.x anyway

@pjfanning
Copy link
Contributor Author

pjfanning commented Jul 13, 2024

@He-Pin This new method in https://github.com/He-Pin/incubator-pekko/blob/05248075bd13a336c9af079cb44a61986dc1f751/stream-testkit/src/main/scala/org/apache/pekko/stream/testkit/StreamTestKit.scala#L869 doesn't make sense to me. The PartialFunction is a Scala function, not a Java function. This seems like a not very useful Java API. The other changes in #1186 seem mainly ok to me but could we consider these?

  • removing the Java API expectNextWithTimeoutPF
  • or changing the Java API expectNextWithTimeoutPF to use a Java function.

When I say the other changes in #1186 are mainly ok, there are other new Java API methods that take Scala Partial Functions as inputs.

How do Java users even create a Scala Partial Function?

@He-Pin
Copy link
Member

He-Pin commented Jul 13, 2024

Yes, but a user can build a PartialFunction with the helper, such as the Receive builder.

@pjfanning
Copy link
Contributor Author

Yes, but a user can build a PartialFunction with the helper, such as the Receive builder.

The ReceiveBuilder will not work for this stream-testkit use case. Unless we have a builder that can build a PartialFunction[Any, T] - does that exist?

@He-Pin
Copy link
Member

He-Pin commented Jul 13, 2024

@pjfanning Yes, org.apache.pekko.japi.pf.PFBuilder.

@pjfanning
Copy link
Contributor Author

@pjfanning Yes, org.apache.pekko.japi.pf.PFBuilder.

Thanks - there seem to be some useful classes in the org.apache.pekko.japi.pf package.

https://pekko.apache.org/japi/pekko/current/org/apache/pekko/japi/pf/package-summary.html

pjfanning added a commit to pjfanning/incubator-pekko that referenced this issue Jul 19, 2024
pjfanning added a commit that referenced this issue Jul 19, 2024
* add known issue for #1393

* Update docs/src/main/paradox/release-notes/releases-1.1.md

Co-authored-by: Arnout Engelen <[email protected]>

---------

Co-authored-by: Arnout Engelen <[email protected]>
@raboof
Copy link
Member

raboof commented Jul 29, 2024

@He-Pin what do you think we should do here? Should we document the issue we see in apache/pekko-persistence-cassandra#212 or is there a change we can make to stream-testkit to avoid the issue going forward?

If I understand correctly this is only an issue when using Scala 2.12, right? In that case I think the note in #1403 seems sufficient and IMHO we can close this issue (or keep it open for if anyone is interested in looking into it, but remove it from the 1.1.0 milestone)

@pjfanning pjfanning removed this from the 1.1.0-M2 milestone Jul 29, 2024
@pjfanning
Copy link
Contributor Author

I'll close this. It is documented and I think the consensus is not to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants