Principle:Datahub project Datahub Java Client Initialization
| Field | Value |
|---|---|
| Principle Name | Java Client Initialization |
| Category | Client Configuration |
| Status | Active |
| Last Updated | 2026-02-10 |
| Repository | Datahub_project_Datahub |
Overview
The process of constructing an authenticated DataHub client instance for Java-based metadata operations. Client initialization uses the Builder pattern to configure connection parameters (server URL, auth token, timeout, retries) and create a DataHubClientV2 instance that serves as the main entry point for all entity management operations.
Description
Client initialization configures and creates a DataHubClientV2 instance, which is the central object for interacting with DataHub's metadata platform from Java. The initialization process involves:
- Configuration assembly: Connection parameters are collected via a fluent Builder API, including the server URL (required), authentication token, timeout, retry count, SSL verification settings, and emit mode.
- Internal component creation: The client internally creates a RestEmitter (for HTTP communication with DataHub GMS) and an EntityClient (for high-level CRUD operations on entities).
- Server config caching: The client lazily fetches and caches server configuration from the
/configendpoint, with configurable TTL-based cache refresh.
The client supports two construction paths:
- Builder pattern: Explicit configuration via
DataHubClientV2.builder().server(...).token(...).build() - Environment variables: Automatic configuration from
DATAHUB_SERVER/DATAHUB_GMS_URLandDATAHUB_TOKEN/DATAHUB_GMS_TOKEN
The client implements AutoCloseable and is thread-safe, designed to be created once and reused across the application.
Usage
When starting a Java application that will interact with DataHub metadata. The client must be initialized before any entity operations (create, read, update, delete) can be performed. Common initialization patterns include:
- Application startup in a Spring Boot service
- Pipeline initialization in an ETL job
- Test setup in integration test suites
- CLI tool startup
Theoretical Basis
The Builder pattern provides a fluent API for constructing complex objects with many optional parameters, ensuring the object is fully configured before use. This is preferable to telescoping constructors or JavaBeans-style setters because:
- Required parameters (server URL) are enforced at build time
- Optional parameters have sensible defaults
- The constructed object is immutable
- The API is self-documenting via method names
The client follows the Facade pattern, providing a simplified interface to the underlying subsystem of RestEmitter, EntityClient, and configuration objects.
Related
- Implemented by: Datahub_project_Datahub_DataHubClientV2_Builder
Implementation:Datahub_project_Datahub_DataHubClientV2_Builder
- Depends on: Datahub_project_Datahub_Java_SDK_Dependency_Setup
- Related Principle: Datahub_project_Datahub_Entity_Construction
- Related Principle: Datahub_project_Datahub_Entity_Upsert