refactor(sdk)!: make DatahubClient the only way in - #149
Merged
Merged
Conversation
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
force-pushed
the
refactor/java-sdk-client-only-api
branch
from
October 1, 2026 11:50
82c0c5c to
945e3cd
Compare
olavgg
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DatahubClientis the one way in and everything else is reached through it. But almost all of the plumbing was public:ApiHttpandTokenProvider;BatchExecutor's callers, both disk spools andSeriesResolver;*Serviceconstructor, each taking the internalApiHttp;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,SubscriptionListenerand all the plumbing move intoai.intellistream.datahub.sdk.clientbesideDatahubClient, where they can be package-private:ApiHttp,TokenProvider,DatapointIngestor,EventIngestor,BinaryDatapointIngestor,DatapointSpool,DurableSpool,SeriesResolver(BatchExecutorandVaultSecretLoaderalready were);*ServiceandBinaryIngestBuffer. You get them fromclient.timeseries(),binaryBuffer()and so on;SubscriptionListener.connect;TimeseriesService.seriesResolver(), which exposed the internal cache and had no callers;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.mdnow states the rule, so new plumbing stays package-private.Source compatibility
DatahubClientandDatahubConfigimports are unchanged, and those are what most callers import.BinaryIngestBufferandSubscriptionListenernow import fromsdk.clientinstead ofsdk.services,sdk.ingestorsdk.subscriptions. In-repo callers (datahub-analysis,datahub-rvm-convertertests) are updated.Docs
datahub-sdk-docs needs an update. Four snippets import moved types:
docs/guides/ingest-timeseries.mdxanddocs/reference/timeseries.md:sdk.ingest.BinaryIngestBuffer→sdk.client.BinaryIngestBuffer;docs/guides/realtime-subscriptions.mdxanddocs/reference/subscriptions.md:sdk.subscriptions.SubscriptionListener→sdk.client.SubscriptionListener.datahub-docs (operators): no change.
Verification
./gradlew buildis green.SubscriptionListenIT),datahub-analysistests (46) anddatahub-rvm-convertertests pass.mainafter build(sdk): make datahub-sdk publishable to Maven Central, with locally signed, CI-verified releases #148 and fix(sdk): log spool warnings through SLF4J, not System.err #150 merged. fix(sdk): log spool warnings through SLF4J, not System.err #150's SLF4J logging and build(sdk): make datahub-sdk publishable to Maven Central, with locally signed, CI-verified releases #148's doc changes are carried into the moved files, and the full./gradlew buildis green. Merges cleanly with ci: release the platform and the Java SDK together from a vX.Y.Z release #152.🤖 Generated with Claude Code