Closed TheovanKraay closed 2 years ago
This particular API is a good example of async calls ->
https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/main/src/main/java/com/azure/cosmos/examples/crudquickstart/async/SampleCRUDQuickstartAsync.java#L222 Notice how it uses subscribe() instead of block() which is used everywhere else.
subscribe()
block()
For async samples, we should use subscribe() API to subscribe to async API and let them run in background. The samples should reflect this pattern. Otherwise customers will copy paste the blocking calls and doesn't work well in all scenarios.
This particular API is a good example of async calls ->
https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/main/src/main/java/com/azure/cosmos/examples/crudquickstart/async/SampleCRUDQuickstartAsync.java#L222 Notice how it uses
subscribe()
instead ofblock()
which is used everywhere else.For async samples, we should use
subscribe()
API to subscribe to async API and let them run in background. The samples should reflect this pattern. Otherwise customers will copy paste the blocking calls and doesn't work well in all scenarios.