Source:
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { final String partitionKeyPath = information.getPartitionKeyPath(); return 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 database = cosmosAsyncClient.getDatabase(cosmosDatabaseResponse.getProperties().getId()); Mono<CosmosContainerResponse> cosmosContainerResponseMono; if (information.getRequestUnit() == null) { cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties); } else { ThroughputProperties throughputProperties = ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); } return cosmosContainerResponseMono .map(cosmosContainerResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosContainerResponse.getDiagnostics(), null); return cosmosContainerResponse; }) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create container", throwable)); }); }

Target:
public Mono<CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?, ?> information) { return 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 database = cosmosAsyncClient.getDatabase(cosmosDatabaseResponse.getProperties().getId()); Mono<CosmosContainerResponse> cosmosContainerResponseMono; if (information.getRequestUnit() == null) { cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties); } else { ThroughputProperties throughputProperties = ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); } return cosmosContainerResponseMono .map(cosmosContainerResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosContainerResponse.getDiagnostics(), null); return cosmosContainerResponse; }) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to create container", throwable)); }); }