Source:
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create database", throwable)) .flatMap(cosmosDatabaseResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosDatabaseResponse.getDiagnostics(), null); final CosmosContainerProperties cosmosContainerProperties = new CosmosContainerProperties(information.getContainerName(), partitionKeyPath); cosmosContainerProperties.setDefaultTimeToLiveInSeconds(information.getTimeToLive()); cosmosContainerProperties.setIndexingPolicy(information.getIndexingPolicy()); CosmosAsyncDatabase cosmosAsyncDatabase = cosmosAsyncClient .getDatabase(cosmosDatabaseResponse.getProperties().getId()); Mono<CosmosContainerResponse> cosmosContainerResponseMono; if (information.getRequestUnit() == null) { cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties); } else { ThroughputProperties throughputProperties = ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); } return cosmosContainerResponseMono .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create container", throwable)) .doOnNext(cosmosContainerResponse -> CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosContainerResponse.getDiagnostics(), null)); }) .block(); assert response != null; return response.getProperties(); }

Target:
public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final CosmosContainerResponse response = cosmosAsyncClient .createDatabaseIfNotExists(this.databaseName) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create database", throwable)) .flatMap(cosmosDatabaseResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosDatabaseResponse.getDiagnostics(), null); final CosmosContainerProperties cosmosContainerProperties = new CosmosContainerProperties(information.getContainerName(), information.getPartitionKeyPath()); cosmosContainerProperties.setDefaultTimeToLiveInSeconds(information.getTimeToLive()); cosmosContainerProperties.setIndexingPolicy(information.getIndexingPolicy()); CosmosAsyncDatabase cosmosAsyncDatabase = cosmosAsyncClient .getDatabase(cosmosDatabaseResponse.getProperties().getId()); Mono<CosmosContainerResponse> cosmosContainerResponseMono; if (information.getRequestUnit() == null) { cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties); } else { ThroughputProperties throughputProperties = ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); } return cosmosContainerResponseMono .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create container", throwable)) .doOnNext(cosmosContainerResponse -> CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosContainerResponse.getDiagnostics(), null)); }) .block(); assert response != null; return response.getProperties(); }