Source:
public Flux<PartitionOwnership> claimOwnership(PartitionOwnership... requestedPartitionOwnerships) { return Flux.fromArray(requestedPartitionOwnerships).flatMap(partitionOwnership -> { String partitionId = partitionOwnership.getPartitionId(); String blobName = getBlobName(partitionOwnership.getEventHubName(), partitionOwnership.getConsumerGroupName(), partitionId); if (!blobClients.containsKey(blobName)) { blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); } BlobAsyncClient blobAsyncClient = blobClients.get(blobName); Metadata metadata = new Metadata(); metadata.put(OWNER_ID, partitionOwnership.getOwnerId()); Long offset = partitionOwnership.getOffset(); metadata.put(OFFSET, offset == null ? null : String.valueOf(offset)); Long sequenceNumber = partitionOwnership.getSequenceNumber(); metadata.put(SEQUENCE_NUMBER, sequenceNumber == null ? null : String.valueOf(sequenceNumber)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions(); if (ImplUtils.isNullOrEmpty(partitionOwnership.getETag())) { blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions().setIfNoneMatch("*")); return blobAsyncClient.asBlockBlobAsyncClient() .uploadWithResponse(Flux.just(UPLOAD_DATA), 0, null, metadata, null, blobAccessConditions) .flatMapMany(response -> updateOwnershipEtag(response, partitionOwnership), error -> { logger.info(CLAIM_ERROR, partitionId, error.getMessage()); return Mono.empty(); }, Mono::empty); } else { blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions() .setIfMatch(partitionOwnership.getETag())); return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) .flatMapMany(response -> updateOwnershipEtag(response, partitionOwnership), error -> { logger.info(CLAIM_ERROR, partitionId, error.getMessage()); return Mono.empty(); }, Mono::empty); } }); }

Target:
public Flux<PartitionOwnership> claimOwnership(PartitionOwnership... requestedPartitionOwnerships) { return Flux.fromArray(requestedPartitionOwnerships).flatMap(partitionOwnership -> { String partitionId = partitionOwnership.getPartitionId(); String blobName = getBlobName(partitionOwnership.getEventHubName(), partitionOwnership.getConsumerGroupName(), partitionId); if (!blobClients.containsKey(blobName)) { blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); } BlobAsyncClient blobAsyncClient = blobClients.get(blobName); Metadata metadata = new Metadata(); metadata.put(OWNER_ID, partitionOwnership.getOwnerId()); Long offset = partitionOwnership.getOffset(); metadata.put(OFFSET, offset == null ? null : String.valueOf(offset)); Long sequenceNumber = partitionOwnership.getSequenceNumber(); metadata.put(SEQUENCE_NUMBER, sequenceNumber == null ? null : String.valueOf(sequenceNumber)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions(); if (ImplUtils.isNullOrEmpty(partitionOwnership.getETag())) { blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions().setIfNoneMatch("*")); return blobAsyncClient.asBlockBlobAsyncClient() .uploadWithResponse(Flux.just(UPLOAD_DATA), 0, null, metadata, null, blobAccessConditions) .flatMapMany(response -> updateOwnershipETag(response, partitionOwnership), error -> { logger.info(CLAIM_ERROR, partitionId, error.getMessage()); return Mono.empty(); }, Mono::empty); } else { blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions() .setIfMatch(partitionOwnership.getETag())); return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) .flatMapMany(response -> updateOwnershipETag(response, partitionOwnership), error -> { logger.info(CLAIM_ERROR, partitionId, error.getMessage()); return Mono.empty(); }, Mono::empty); } }); }