[JAVA-2551] Make it easier to switch between sync & async drivers Created: 10/Jul/17  Updated: 28/Jan/19  Resolved: 28/Jan/19

Status: Closed
Project: Java Driver
Component/s: API, Async
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Simon Cooper Assignee: Jeffrey Yemin
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to JAVA-2166 Make it easier to mix ConnectionStrin... Closed

 Description   

Currently the sync and async drivers are completely separate to each other - they use different types, different packages, even different ways of creating clients (sync uses MongoClientOptions and individual parameters, async uses ConnectionString and MongoClientSettings).

This makes it really hard to use sync & async APIs together - if you want to do some operations sync and some async, for example.

It should be much easier to move between sync & async APIs, given the same client, database, or collection objects (MongoDatabase.asSync()/MongoDatabase.asAsync())

If not, at least consolidate how you create sync and async MongoClient objects so you can use the same representation of a connection & client options.



 Comments   
Comment by Jeffrey Yemin [ 28/Jan/19 ]

We've decided not to go any further integrating the sync and async stacks. As it is now, the MongoClientSettings can be shared. Applications will have to continue managing separate MongoClient instances for sync and async.

Comment by Jeffrey Yemin [ 03/May/18 ]

In 3.7.0, we introduced the com.mongodb.MongoClientSettings class, a com.mongodb.client.MongoClients entry point that accepts the new MongoClientSettings, and new methods on com.mongodb.async.client.MongoClients that accept the new MongoClientSettings class.

Comment by Jeffrey Yemin [ 31/Jan/18 ]

The first step of this is being done in scope of JAVA-2166. Once that's done we can consider adding the ability to use the new com.mongodb.com.MongoClientSettings in both the sync and async drivers.

Generated at Thu Feb 08 08:57:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.