Repository navigation
feat(cli): direct-mode CLI — java -jar kview.jar --cli talks to the broker without a server - #9
Merged
Merged
Conversation
…roker without a server The user-facing ask: 'like other CLIs work — kview topics against the broker'. The thin REST client needed a running Kview server; direct mode does not. - --cli detection in KafkaWrapperApplication.main routes to CliMain, which boots a headless (WebApplicationType.NONE) application context — no Tomcat, no port — and registers the connection as an ad-hoc in-memory cluster profile, so every existing service works unchanged against the broker. - Commands: overview, topics, topic, browse (schema-registry decoded), groups, lag, produce, search (background search service), replay — each with --json output. Security flags cover SASL/mTLS/OAuth via SecuritySettings; --schema-registry URL attaches a volatile registry for payload decoding; --data-dir isolates state. - shipped kview / kview.cmd wrapper scripts that pick up the jar next to them, so 'kview topics --bootstrap-server ...' works after a release download or mvn package. - KafkaClusterManager.registerAdHoc + RegistrySettingsStore.attachVolatile are the only touch points on existing code (in-memory only, nothing persisted). - tests: CliModeTest boots its own headless context against an embedded broker and drives produce/browse/topics end to end plus exit-code contract. Full suite 66/66.
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.
User-facing feature: an independent CLI mode —
kview topics --bootstrap-server localhost:9092like every other Kafka CLI, with no running Kview server. Until now the CLI was a thin REST client that required the server; this adds the direct path. Stacked on #8 — merge #1 → … → #8 → this.How it works
KafkaWrapperApplication.maindetects--cliand routes toCliMain, which boots a headless application context (WebApplicationType.NONE— no Tomcat, no port) and registers the connection as an ad-hoc in-memory cluster profile. That single hook makes every existing service work unchanged against the broker:--schema-registry URLattaches a volatile registry (never persisted).--security-protocol,--sasl-*,--keystore-*,--truststore-*,--oauth-*,--no-hostname-verification) map onto the existingSecuritySettings, so SASL_SSL/SCRAM/mTLS/OAuth work the way the server does them.--jsonon every command;--data-dirisolates state; exit codes 0/1/2 (success/failure/usage).Shipped
kview(sh) andkview.cmdwrapper scripts pick up the jar next to them, so after a release download ormvn packageit's justkview topics --bootstrap-server ....Only two touch points on existing code, both in-memory-only:
KafkaClusterManager.registerAdHocandRegistrySettingsStore.attachVolatile.Verification
CliModeTestboots its own headless context against an embedded broker and drives produce → browse → topics end to end (JSON output asserted), plus the exit-code contract (help=0, unknown command=2, missing required flag=1).java -jar kview.jar --cli helpprints usage and exits 0.