[JAVA-3903] Replace internal use of callbacks with Reactor in mongodb-driver-core module Created: 08/Dec/20  Updated: 15/Sep/23

Status: Backlog
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-5082 Internal framework to increase veloci... In Code Review
Epic Link: JAVA-3703

 Description   

Replace internal use of callbacks with Reactor in mongodb-driver-core module. This is internal and makes no change to the public API.

The driver will however have a hard dependency on Project Reactor going forward



 Comments   
Comment by Maxim Katcharov [ 18/Apr/23 ]

We should have a look at some existing code that we would like to improve with this approach, and consider what it looks like with the Reactor approach, versus potential alternatives.

The underlying problems that I saw were:

  1. There is increasing drift between the sync and async variants of methods. It should be possible to compare these side by side, and see the same logic, in the same visual order, without redundant invocations of callbacks.
  2. Furthermore, some parts of the logic are entirely extracted into separate methods (for example, a lengthy async method is broken up into smaller methods in a different way than the sync method is).
  3. There is general redundancy in the code.

Some of this can be cleaned up with relatively small helper methods, or a helper class, without the need to introduce a dependency, and the associated complexity. It might also be possible to take this approach sooner and more incrementally than a large-scale conversion into Reactor.

Are there other reasons to introduce Reactor, apart from code clarity? For example, I am unsure what the "Reactor context" comment above entails. Perhaps there are reasons related to closer integration with our async code, or something else?

Comment by Ross Lawley [ 11/May/21 ]

Request: If possible see if the Reactor context could be supplied to the Mongo Command Listeners.

Generated at Thu Feb 08 09:00:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.