Skip to content

refactor(sdk)!: make DatahubClient the only way in - #149

Merged
olavgg merged 1 commit into
mainfrom
refactor/java-sdk-client-only-api
Oct 1, 2026
Merged

olavgg merged 1 commit into
mainfrom
refactor/java-sdk-client-only-api

Conversation

@JosteinGj

@JosteinGj JosteinGj commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

The SDK is about to be published to Maven Central for the first time. Once it is, every public type and constructor becomes API we cannot remove without a breaking release.

The intended shape is that DatahubClient is the one way in and everything else is reached through it. But almost all of the plumbing was public:

  • ApiHttp and TokenProvider;
  • the ingestors, BatchExecutor's callers, both disk spools and SeriesResolver;
  • every *Service constructor, each taking the internal ApiHttp;
  • SubscriptionListener.connect(httpClient, baseUrl, token, mapper, ...).

A caller could build a service around their own HTTP plumbing, and we would have had to keep those constructors stable forever. Narrowing them after publication is a breaking change, so it has to happen before 0.3.0.

What changes

Java can only hide a constructor from other packages. So the services, BinaryIngestBuffer, SubscriptionListener and all the plumbing move into ai.intellistream.datahub.sdk.client beside DatahubClient, where they can be package-private:

  • package-private classes: ApiHttp, TokenProvider, DatapointIngestor, EventIngestor, BinaryDatapointIngestor, DatapointSpool, DurableSpool, SeriesResolver (BatchExecutor and VaultSecretLoader already were);
  • public classes with package-private constructors: every *Service and BinaryIngestBuffer. You get them from client.timeseries(), binaryBuffer() and so on;
  • package-private factory: SubscriptionListener.connect;
  • removed: TimeseriesService.seriesResolver(), which exposed the internal cache and had no callers;
  • inlined: BinaryIngestOptions.executorOptions() into its only caller, since the ingestor now lives in another package.

The other packages keep only value types a caller names or receives, which stay public: DatahubApiException, IngestOptions, BinaryIngestOptions, IngestResult, SubscriptionMessage, SubscriptionError, Datapoint, UuidV7.

The SDK's AGENTS.md now states the rule, so new plumbing stays package-private.

Source compatibility

  • DatahubClient and DatahubConfig imports are unchanged, and those are what most callers import.
  • Service types, BinaryIngestBuffer and SubscriptionListener now import from sdk.client instead of sdk.services, sdk.ingest or sdk.subscriptions. In-repo callers (datahub-analysis, datahub-rvm-converter tests) are updated.
  • Nothing has been published yet, so no released artifact is affected.

Docs

datahub-sdk-docs needs an update. Four snippets import moved types:

  • docs/guides/ingest-timeseries.mdx and docs/reference/timeseries.md: sdk.ingest.BinaryIngestBuffer → sdk.client.BinaryIngestBuffer;
  • docs/guides/realtime-subscriptions.mdx and docs/reference/subscriptions.md: sdk.subscriptions.SubscriptionListener → sdk.client.SubscriptionListener.

datahub-docs (operators): no change.

Verification

🤖 Generated with Claude Code

olavgg
olavgg previously approved these changes Sep 30, 2026
Services, the ingest machinery and the HTTP/auth plumbing move into
sdk.client, so the plumbing and every service constructor can be
package-private. Callers reach a service only through the client. The other
packages keep only value types. Drops TimeseriesService.seriesResolver(),
which had no callers.

Services and BinaryIngestBuffer/SubscriptionListener now import from
sdk.client. DatahubClient and DatahubConfig imports are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
@JosteinGj
JosteinGj force-pushed the refactor/java-sdk-client-only-api branch from 82c0c5c to 945e3cd Compare October 1, 2026 11:50
@JosteinGj
JosteinGj requested a review from olavgg October 1, 2026 12:06
@olavgg
olavgg merged commit 2a74e4c into main Oct 1, 2026
9 checks passed
@olavgg
olavgg deleted the refactor/java-sdk-client-only-api branch October 1, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants