private JsonNode getLeaseContainerRecord()

in src/main/java/com/azure/cosmos/kafka/connect/source/CosmosDBSourceTask.java [108:120]


    private JsonNode getLeaseContainerRecord() {
        String sql = "SELECT * FROM c WHERE IS_DEFINED(c.Owner)";
        Iterable<JsonNode> filteredDocs = leaseContainer.queryItems(sql, new CosmosQueryRequestOptions(), JsonNode.class).toIterable();
        if (filteredDocs.iterator().hasNext()) {
            JsonNode result = filteredDocs.iterator().next();
            // Return node only if it has the continuation token field present
            if (result.has(CONTINUATION_TOKEN)) {
                return result;
            }
        }

        return null;
    }