Azure Cosmos DB SDK for Java
Build Cosmos DB Applications with Java
Integrating Azure Cosmos DB into Java applications requires understanding SDK patterns and best practices. This skill provides comprehensive guidance for database operations, reactive programming, and global distribution.
Descargar el ZIP de la skill
Subir en Claude
Ve a Configuración → Capacidades → Skills → Subir skill
Activa y empieza a usar
Pruébalo
Usando "Azure Cosmos DB SDK for Java". Create a CosmosClient with session consistency and preferred regions
Resultado esperado:
CosmosClient configured with endpoint from environment variables, session consistency level, preferred regions (West US, East US), direct mode connection, and user agent suffix for application identification.
Usando "Azure Cosmos DB SDK for Java". Query users where status equals active
Resultado esperado:
Parameterized SQL query executed against Cosmos container, returning CosmosPagedIterable of User objects filtered by status parameter, with results iterated and printed to console.
Auditoría de seguridad
SeguroThis is a prompt-only skill containing documentation and code examples for Azure Cosmos DB Java SDK. Static analysis scanned 0 files with 0 findings and a risk score of 0/100. The skill provides instructional content for database operations without any executable code. The only risk factor is env_access for environment variable usage in authentication examples, which is standard practice for credential management.
Factores de riesgo
🔑 Variables de entorno (1)
Puntuación de calidad
Lo que puedes crear
Enterprise Application Developer
Build scalable backend services that store and retrieve data from globally distributed Cosmos DB containers with proper partitioning strategies.
Cloud Migration Specialist
Migrate existing database applications to Azure Cosmos DB with guidance on SDK integration and consistency model selection.
Full-Stack Developer
Implement reactive data access patterns using the async client for high-throughput scenarios in modern web applications.
Prueba estos prompts
Show me how to create a CosmosClient in Java using environment variables for the endpoint and key. Include proper error handling.
Generate Java code to create a database and container in Cosmos DB. The container should use /userId as the partition key. Use the async client pattern.
Write Java code that creates, reads, updates, and deletes a user document in Cosmos DB using reactive chains with the async client. Include proper error handling for each operation.
Create a parameterized SQL query in Java that retrieves users by status from Cosmos DB. Configure CosmosQueryRequestOptions for optimal performance and iterate through paged results.
Mejores prácticas
- Reuse CosmosClient instance throughout your application - creating new clients is expensive
- Choose partition keys with high cardinality and even distribution for optimal scaling
- Use async client for high-throughput scenarios and reactive programming patterns
Evitar
- Creating new CosmosClient instances for each operation - causes connection pool exhaustion
- Using strong consistency level without understanding latency implications across regions
- Ignoring 429 rate limit responses - always implement retry logic or use built-in retry policy
Preguntas frecuentes
What is the difference between CosmosClient and CosmosAsyncClient?
How do I handle authentication for Cosmos DB in Java?
What consistency level should I choose for my application?
How do I optimize query performance in Cosmos DB?
What happens when I exceed my provisioned RU/s?
Can I use this skill for other Cosmos DB APIs besides NoSQL?
Detalles del desarrollador
Autor
sickn33Licencia
MIT
Repositorio
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-cosmos-javaRef.
main
Estructura de archivos
📄 SKILL.md