Way to get the sync bucket form the async one


I use the AsyncBucket throughout my whole sample app, but in one place it would be nice to get the sync version. As there is a way to get the AsyncBucket from the Bucket, is there any reason why there is no way to get the sync bucket from the AsyncBucket? I build the connection like:

Bucket bucket = cluster.openBucket();
return bucket.async();

I expected this to work as well

AsyncBucket asyncBucket = cluster.openBucket().async();

Just wondering why this is not available, and what is the recommended way to to something like this? Exposing the original sync bucket along with the async one maybe?


Hi Phil,

this is not supported (and possible), for the simple reason that the synchronous API is a wrapper around the asynchronous one and as a result the async API has no clue about the sync one.

If you need both access I recommend you to use the sync bucket and then chain in an .async() one where needed, or if you have mostly async calls but you want a few blocking ones, just block on the observable right away (which is what the wrapper does aynways) like: .timeout(…).toBlocking().single();