azure-cosmos-java

Perform NoSQL CRUD and query operations against Azure Cosmos DB from Java.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-cosmos-java-davidrrowley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: azure-cosmos-java
Source: https://github.com/davidrrowley/CortexYouV3/tree/main/.agents/skills/azure-cosmos-java
Command: npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-cosmos-java-davidrrowley

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides Java developers a consistent, documented way to interact with Azure Cosmos DB so they can implement scalable NoSQL data access without reinventing client patterns and error handling logic.

Core Features & Use Cases

  • Client creation and configuration guidance for both synchronous CosmosClient and reactive CosmosAsyncClient, including credential and preferred-region options.
  • Database and container lifecycle operations, partition key design guidance, CRUD patterns, parameterized queries, paging with continuation tokens, and RU charge monitoring.
  • Best practices for production scenarios: reuse and lifecycle management of clients, 429/rate-limit handling, retry policies, direct/gateway modes, and region-aware high-throughput architectures.
  • Typical use cases include multi-region telemetry ingestion, session-consistent user stores, batched async processing pipelines, and query-heavy analytics with controlled RU consumption.

Quick Start

Instantiate a CosmosAsyncClient using environment variables COSMOS_ENDPOINT and COSMOS_KEY, create or open a database and container, then run a single create-read-update-delete sequence to verify connectivity and basic CRUD behavior.

Frequently Asked Questions about azure-cosmos-java

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle 429 rate-limiting errors in Java Cosmos DB applications?▼

To handle 429 rate-limiting errors in Java Cosmos DB applications, apply built-in retry policies and monitor request unit charges. Configure throughput settings and implement proper client lifecycle management to manage 429 errors effectively in production services.

What is the difference between sync and reactive Cosmos DB clients in Java?▼

The difference between sync and reactive Cosmos DB clients in Java is that CosmosClient provides synchronous CRUD operations while CosmosAsyncClient handles asynchronous reactive workflows. Both support parameterized queries and client lifecycle management for production services.

Can I configure preferred regions for multi-region Cosmos DB reads in Java?▼

Yes, you can configure preferred regions for multi-region Cosmos DB reads in Java. Both CosmosClient and CosmosAsyncClient support credential and preferred-region options to build region-aware high-throughput architectures for globally distributed low-latency workflows.

How do I monitor request unit charges when querying Cosmos DB with Java?▼

To monitor request unit charges when querying Cosmos DB with Java, track RU consumption during database and container operations. The Java client supports RU charge monitoring for query-heavy analytics and batched async processing pipelines with controlled throughput.

What is the best way to design partition keys for NoSQL Cosmos DB containers in Java?▼

The best way to design partition keys for NoSQL Cosmos DB containers in Java is to follow partition key design guidance that supports globally distributed low-latency workflows. Proper partition key selection ensures scalable data access for multi-region telemetry ingestion and session-consistent user stores.