This new Segment analytics client for Java is designed to address the shortcomings of both analytics-java and especially analytics-kotlin.
This project is designed specifically for server-side use cases, prioritizing reliability, configurability, and operational transparency for backend workloads. Unlike analytics-kotlin, which is optimized for device-mode and mobile, this implementation is server-centric from the ground up.
Events are only written to disk if uploads fail or queues overflow, minimizing disk I/O under normal conditions. This is a middle ground between analytics-java (no durability) and analytics-kotlin (always persists).
Batch files are uniquely named and do not rely on a shared index file, making the implementation safe for multiple processes or HA deployments.
We provide a configurable, robust retry mechanism with exponential backoff and a circuit breaker to avoid hammering the Segment API during outages or rate limits.
Our implementation is stateless regarding user identity and does not assume a single user context. The userId must be explicitly provided with each event, making it suitable for multi-user server environments.
We implement strict backpressure and bounded queues. If disk or network is slow, the client will block or reject new events, preventing unbounded memory growth.
We avoid reliance on JVM shutdown hooks and plugin classloaders, ensuring predictable shutdown behavior in all environments, including those using custom classloaders.
This project does not support or require plugin architectures, avoiding the complexity and maintenance burden seen in analytics-kotlin. The codebase is simpler and easier to understand and maintain. It is intentionally kept simple, with clear separation of concerns and minimal dependencies, making it easy for teams familiar with analytics-java to adopt and contribute.
We use standard Java concurrency primitives, avoiding custom or in-house frameworks, which simplifies debugging and maintenance.
This project is pure Java, avoiding any Kotlin dependencies. This improves compatibility, reduces maintenance overhead, and ensures better tooling support across all Java environments. As a pure Java implementation, there is no additional Kotlin runtime thread overhead.
The upload endpoint is fully configurable via documented settings. There is no dependency on undocumented CDN settings interaction or external configuration fetches.
This project is inspired by analytics-java, but adds persistence for reliability. It directly addresses the pain points with both analytics-java and especially analytics-kotlin, providing a robust and maintainable alternative for Java server environments.