Skip to content

Add support for cancellation on reactive session run #1457

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

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

injectives
Copy link
Contributor

@injectives injectives commented Jul 14, 2023

This update brings support for cancelling subscription on reactive session run methods, like:

  • org.neo4j.driver.reactive.ReactiveSession.run(..)
  • org.neo4j.driver.reactivestreams.ReactiveSession.run(..)

If subscription is cancelled before an instance of the ReactiveResult is published, the driver will rollback the initiated query by sending the Bolt RESET message and will release the network connection back to its connection pool. This will be done in the background.

Once the ReactiveResult is published, the cancellation with the rollback is no longer possible.

In addition, this update makes the driver wait until subscriber subscribes to the publisher before dispatching the query to the server. Previously, the driver would do that immediately upon calling the run method.

@injectives injectives marked this pull request as draft July 14, 2023 15:31
@injectives injectives force-pushed the feature/sessionrun branch 5 times, most recently from 8e7df8d to b32717a Compare July 17, 2023 22:27
@injectives injectives changed the title Initial impl Add support for cancellation on reactive session run Jul 18, 2023
@injectives injectives force-pushed the feature/sessionrun branch from 7f93287 to 791f79f Compare July 18, 2023 09:55
This update brings support for cancelling subscription on reactive session `run` methods, like:
- `org.neo4j.driver.reactive.ReactiveSession.run(..)`
- `org.neo4j.driver.reactivestreams.ReactiveSession.run(..)`

If subscription is cancelled before an instance of the `ReactiveResult` is published, the driver will rollback the initiated query by sending the Bolt `RESET` message and will release the network connection back to its connection pool. This will be done in the background.

Once the `ReactiveResult` is published, the cancellation with the rollback is no longer possible.

In addition, this update makes the driver wait until subscriber subscribes to the publisher before dispatching the query to the server. Previously, the driver would do that immediately upon calling the `run` method.
@injectives injectives force-pushed the feature/sessionrun branch from 791f79f to 34d8511 Compare July 18, 2023 10:31
@injectives injectives marked this pull request as ready for review July 18, 2023 10:38
@injectives injectives requested a review from bigmontz July 18, 2023 11:48
Copy link
Contributor

@bigmontz bigmontz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@injectives injectives merged commit 6f8af77 into neo4j:5.0 Jul 18, 2023
@injectives injectives deleted the feature/sessionrun branch July 18, 2023 13:33
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

Successfully merging this pull request may close these issues.

2 participants