class: KafkaAdmin
[34:14] (extern: com.lehman.aussom.KafkaAdmin) extends: object
The Kafka Admin client: cluster management from Aussom code. adm = new KafkaAdmin("broker1:9092"); adm.connect(); adm.createTopic("orders.created", 3); Every method is synchronous: it blocks on the broker (bounded by default.api.timeout.ms, settable with setConfig) and returns native Aussom maps and lists. Shared shapes: topic-partition maps { "topic", "partition" }; offsets lists (those maps plus "offset"); ACL binding maps { "resourceType", "name", "patternType", "principal", "host", "operation", "permissionType" }.
Methods
-
KafkaAdmin (
string Bootstrap)Creates an admin client for a bootstrap address. Does not connect yet.
- @p
Bootstrapis a string with host:port[,host:port...].
- @p
-
newAdmin (
string Bootstrap) -
setClientId (
string Id)Sets the client id used in broker logs, metrics, and quotas.
- @p
Idis a string with the client id. - @r
thisobject
- @p
-
setConfig (
string Key, Value)Sets any admin config key directly (security, default.api.timeout.ms, and the rest). The ssl.*.location keys are rejected here - use the dedicated setters.
- @p
Keyis a string with the config key. - @p
Valueis the config value. - @r
thisobject
- @p
-
setConfigs (
map Cfg)Applies a whole config map at once.
- @p
Cfgis a map of config key to value. - @r
thisobject
- @p
-
setSslKeystoreFile (
string Path)Sets the TLS keystore file. Under Aussom Server the path is resolved through the app_data sandbox.
- @p
Pathis a string with the app-relative keystore path. - @r
thisobject
- @p
-
setSslTruststoreFile (
string Path)Sets the TLS truststore file. Under Aussom Server the path is resolved through the app_data sandbox.
- @p
Pathis a string with the app-relative truststore path. - @r
thisobject
- @p
-
connect ()
Builds the admin client from the stored config.
- @r
thisobject
- @r
-
close (
int TimeoutMs = -1)Closes the admin client. Idempotent.
- @p
TimeoutMsis an optional int bound on the close wait. - @r
thisobject
- @p
-
isConnected ()
Reports whether connect() has been called.
- @r
Abool with true when connected.
- @r
-
metrics ()
Gets the client metrics.
- @r
Amap of metric group.name to numeric value.
- @r
-
createTopic (
string Name, int Partitions = 1, int Replication = 1, map Configs = null)Creates one topic.
- @p
Nameis a string with the topic name. - @p
Partitionsis an optional int partition count (default 1). - @p
Replicationis an optional int replication factor (default 1). - @p
Configsis an optional map of topic config overrides. - @r
thisobject
- @p
-
createTopics (
list Specs)Creates several topics at once.
- @p
Specsis a list of { "name", "partitions"?, "replication"?, "configs"? } maps. - @r
thisobject
- @p
-
deleteTopics (
list Names)Deletes topics by name.
- @p
Namesis a list of topic name strings. - @r
thisobject
- @p
-
listTopics (
bool IncludeInternal = false)Lists topics.
- @p
IncludeInternalis an optional bool to include internal topics like __consumer_offsets. - @r
Alist of { "name", "topicId", "internal" } maps.
- @p
-
describeTopics (
list Names)Describes topics by name.
- @p
Namesis a list of topic name strings. - @r
Alist of { "name", "topicId", "internal", "partitions": [{ "partition", "leader", "replicas", "isr" }] } maps.
- @p
-
createPartitions (
map TopicToCount)Grows topics to new total partition counts (never shrinks).
- @p
TopicToCountis a map of topic name to total count. - @r
thisobject
- @p
-
deleteRecords (
list Offsets)Deletes all records before the given offsets.
- @p
Offsetsis an offsets list; each entry's offset is the first one to KEEP. - @r
Alist of { "topic", "partition", "lowWatermark" } maps.
- @p
-
describeConfigs (
string Type, string Name)Describes the configs of one resource.
- @p
Typeis a string: topic, broker, broker_logger, group, or client_metrics. - @p
Nameis a string with the resource name (a broker id for brokers). - @r
Amap of config name to { "value", "source", "readOnly", "sensitive" }.
- @p
-
alterConfigs (
string Type, string Name, list Ops)Incrementally alters the configs of one resource.
- @p
Typeis a string with the resource type (see describeConfigs). - @p
Nameis a string with the resource name. - @p
Opsis a list of { "name", "value"?, "op"? } maps; op is set (default), delete, append, or subtract. - @r
thisobject
- @p
-
listConfigResources (
list Types = null)Lists config resources on the cluster, optionally filtered by type strings.
- @p
Typesis an optional list of resource type strings. - @r
Alist of { "type", "name" } maps.
- @p
-
createAcls (
list Bindings)Creates ACL bindings.
- @p
Bindingsis a list of ACL binding maps; patternType defaults to literal, host to "*", permissionType to allow. - @r
thisobject
- @p
-
describeAcls (
map Filter)Describes ACL bindings matching a filter.
- @p
Filteris a map with any of the binding keys; missing keys match anything ({} matches all). - @r
Alist of ACL binding maps.
- @p
-
deleteAcls (
list Filters)Deletes ACL bindings matching the filters.
- @p
Filtersis a list of filter maps. - @r
Alist of the deleted ACL binding maps.
- @p
-
listGroups (
list Types = null)Lists groups of every kind.
- @p
Typesis an optional list of type strings to filter: consumer, classic, share, streams. - @r
Alist of { "groupId", "type", "state", "protocol" } maps.
- @p
-
describeConsumerGroups (
list Ids)Describes consumer groups.
- @p
Idsis a list of group id strings. - @r
Alist of { "groupId", "state", "type", "partitionAssignor", "coordinator", "simple", "members" } maps; each member is { "memberId", "clientId", "host", "groupInstanceId", "assignment" }.
- @p
-
deleteConsumerGroups (
list Ids)Deletes consumer groups (must be empty).
- @p
Idsis a list of group id strings. - @r
thisobject
- @p
-
listConsumerGroupOffsets (
string GroupId)Lists a consumer group's committed offsets.
- @p
GroupIdis a string with the group id. - @r
Anoffsets list.
- @p
-
alterConsumerGroupOffsets (
string GroupId, list Offsets)Overwrites a consumer group's committed offsets. The group must have no active members.
- @p
GroupIdis a string with the group id. - @p
Offsetsis an offsets list. - @r
thisobject
- @p
-
deleteConsumerGroupOffsets (
string GroupId, list TopicPartitions)Deletes a consumer group's committed offsets for partitions.
- @p
GroupIdis a string with the group id. - @p
TopicPartitionsis a list of topic-partition maps. - @r
thisobject
- @p
-
removeMembersFromConsumerGroup (
string GroupId, list MemberIds = null)Removes members from a consumer group.
- @p
GroupIdis a string with the group id. - @p
MemberIdsis an optional list of member ids; absent removes every member. - @r
thisobject
- @p
-
describeClassicGroups (
list Ids)Describes classic-protocol groups.
- @p
Idsis a list of group id strings. - @r
Alist of { "groupId", "state", "protocol", "coordinator", "memberCount" } maps.
- @p
-
describeShareGroups (
list Ids)Describes share groups (broker 4.2+).
- @p
Idsis a list of group id strings. - @r
Alist of { "groupId", "state", "coordinator", "groupEpoch", "members" } maps.
- @p
-
deleteShareGroups (
list Ids)Deletes share groups (must be empty).
- @p
Idsis a list of group id strings. - @r
thisobject
- @p
-
listShareGroupOffsets (
string GroupId)Lists a share group's start offsets.
- @p
GroupIdis a string with the group id. - @r
Alist of { "topic", "partition", "startOffset" } maps.
- @p
-
alterShareGroupOffsets (
string GroupId, list Offsets)Overwrites a share group's start offsets. The group must have no active members.
- @p
GroupIdis a string with the group id. - @p
Offsetsis an offsets list. - @r
thisobject
- @p
-
deleteShareGroupOffsets (
string GroupId, list Topics)Deletes a share group's offsets for whole topics.
- @p
GroupIdis a string with the group id. - @p
Topicsis a list of topic name strings. - @r
thisobject
- @p
-
describeStreamsGroups (
list Ids)Describes broker-side streams groups (KIP-1071).
- @p
Idsis a list of group id strings. - @r
Alist of { "groupId", "state", "coordinator", "groupEpoch", "memberCount" } maps.
- @p
-
deleteStreamsGroups (
list Ids)Deletes streams groups (must be empty).
- @p
Idsis a list of group id strings. - @r
thisobject
- @p
-
listStreamsGroupOffsets (
string GroupId)Lists a streams group's committed offsets.
- @p
GroupIdis a string with the group id. - @r
Anoffsets list.
- @p
-
alterStreamsGroupOffsets (
string GroupId, list Offsets)Overwrites a streams group's committed offsets. The group must have no active members.
- @p
GroupIdis a string with the group id. - @p
Offsetsis an offsets list. - @r
thisobject
- @p
-
deleteStreamsGroupOffsets (
string GroupId, list TopicPartitions)Deletes a streams group's committed offsets for partitions.
- @p
GroupIdis a string with the group id. - @p
TopicPartitionsis a list of topic-partition maps. - @r
thisobject
- @p
-
listOffsets (
list Query)Looks up partition offsets by spec.
- @p
Queryis a list of { "topic", "partition", "spec" } maps; spec is earliest, latest, max_timestamp, or an int timestamp. - @r
Alist of { "topic", "partition", "offset", "timestamp" } maps.
- @p
-
describeCluster ()
Describes the cluster.
- @r
Amap { "clusterId", "controller", "nodes" }; nodes are { "id", "host", "port", "rack" } maps.
- @r
-
describeFeatures ()
Describes the cluster's feature levels.
- @r
Amap { "finalized": { name: { "minVersionLevel", "maxVersionLevel" } }, "supported": { name: { "minVersion", "maxVersion" } } }.
- @r
-
updateFeatures (
map Updates)Updates finalized feature levels.
- @p
Updatesis a map of feature name to { "maxVersionLevel", "upgradeType"? } (upgrade, safe_downgrade, unsafe_downgrade). - @r
thisobject
- @p
-
describeMetadataQuorum ()
Describes the KRaft metadata quorum.
- @r
Amap { "leaderId", "leaderEpoch", "highWatermark", "voters", "observers" }.
- @r
-
unregisterBroker (
int BrokerId)Unregisters a stopped broker from a KRaft cluster.
- @p
BrokerIdis an int with the broker id. - @r
thisobject
- @p
-
addRaftVoter (
int VoterId, string DirectoryId, list Endpoints)Adds a KRaft controller voter.
- @p
VoterIdis an int with the voter's node id. - @p
DirectoryIdis a string with the voter's directory uuid. - @p
Endpointsis a list of { "name", "host", "port" } maps. - @r
thisobject
- @p
-
removeRaftVoter (
int VoterId, string DirectoryId)Removes a KRaft controller voter.
- @p
VoterIdis an int with the voter's node id. - @p
DirectoryIdis a string with the voter's directory uuid. - @r
thisobject
- @p
-
electLeaders (
string Type, list TopicPartitions)Triggers partition leader election.
- @p
Typeis a string: preferred or unclean. - @p
TopicPartitionsis a list of topic-partition maps. - @r
thisobject
- @p
-
alterPartitionReassignments (
list Reassignments)Starts or cancels partition reassignments.
- @p
Reassignmentsis a list of { "topic", "partition", "replicas": [brokerIds] or null to cancel } maps. - @r
thisobject
- @p
-
listPartitionReassignments (
list TopicPartitions = null)Lists in-progress partition reassignments.
- @p
TopicPartitionsis an optional list of topic-partition maps to narrow the query. - @r
Alist of { "topic", "partition", "replicas", "addingReplicas", "removingReplicas" } maps.
- @p
-
describeLogDirs (
list BrokerIds)Describes broker log directories.
- @p
BrokerIdsis a list of int broker ids. - @r
Amap of broker id to { dir: { "error", "totalBytes", "usableBytes", "replicas" } }.
- @p
-
describeReplicaLogDirs (
list Replicas)Describes where specific replicas live on disk.
- @p
Replicasis a list of { "broker", "topic", "partition" } maps. - @r
Alist of { "broker", "topic", "partition", "currentDir", "futureDir" } maps.
- @p
-
alterReplicaLogDirs (
list Moves)Moves replicas between log directories on a broker.
- @p
Movesis a list of { "broker", "topic", "partition", "dir" } maps. - @r
thisobject
- @p
-
describeClientQuotas (
list Filter)Describes client quotas.
- @p
Filteris a list of { "entityType", "match" } maps; entityType is user, client-id, or ip; match is a name, null for the default quota, or "any". An empty list matches all. - @r
Alist of { "entity", "quotas" } maps.
- @p
-
alterClientQuotas (
list Alterations)Alters client quotas.
- @p
Alterationsis a list of { "entity": { entityType: name-or-null }, "set": { quota: value }, "remove": [quotaNames] } maps. - @r
thisobject
- @p
-
describeUserScramCredentials (
list Users = null)Describes SCRAM credentials.
- @p
Usersis an optional list of user names (absent = all). - @r
Alist of { "user", "credentials": [{ "mechanism", "iterations" }] } maps.
- @p
-
alterUserScramCredentials (
list Ops)Upserts or deletes SCRAM credentials.
- @p
Opsis a list of maps { "user", "mechanism" (SCRAM-SHA-256 / SCRAM-SHA-512), "password" + optional "iterations" to upsert, or "op": "delete" }. - @r
thisobject
- @p
-
createDelegationToken (
map Options = null)Creates a delegation token. Requires a SASL-authenticated connection and a broker with a token master key.
- @p
Optionsis an optional map { "owner", "renewers", "maxLifetimeMs" }; principals are "User:name" strings. - @r
Amap { "tokenId", "hmac", "owner", "issueTimestamp", "expiryTimestamp", "maxTimestamp", "renewers" }.
- @p
-
renewDelegationToken (
string Hmac, int RenewTimePeriodMs = -1)Renews a delegation token.
- @p
Hmacis a string with the token's base64 HMAC. - @p
RenewTimePeriodMsis an optional int renew period. - @r
Anint with the new expiry timestamp.
- @p
-
expireDelegationToken (
string Hmac, ExpiryTimePeriodMs = null)Expires a delegation token (zero or negative period cancels it immediately).
- @p
Hmacis a string with the token's base64 HMAC. - @p
ExpiryTimePeriodMsis an optional int expiry period (untyped so absent and negative stay distinct). - @r
Anint with the new expiry timestamp.
- @p
-
describeDelegationToken (
list Owners = null)Describes delegation tokens.
- @p
Ownersis an optional list of "User:name" owner principals. - @r
Alist of token maps (see createDelegationToken).
- @p
-
listTransactions ()
Lists transactions known to the cluster.
- @r
Alist of { "transactionalId", "producerId", "state" } maps.
- @r
-
describeTransactions (
list Ids)Describes transactions.
- @p
Idsis a list of transactional id strings. - @r
Alist of { "transactionalId", "state", "producerId", "producerEpoch", "coordinatorId", "timeoutMs", "topicPartitions" } maps.
- @p
-
abortTransaction (
map Spec)Forcefully aborts an open transaction by partition and producer details.
- @p
Specis a map { "topic", "partition", "producerId", "producerEpoch", "coordinatorEpoch" }. - @r
thisobject
- @p
-
forceTerminateTransaction (
string TransactionalId)Forcefully terminates the open transaction of a transactional id.
- @p
TransactionalIdis a string with the transactional id. - @r
thisobject
- @p
-
fenceProducers (
list TransactionalIds)Fences out the current producers of transactional ids.
- @p
TransactionalIdsis a list of transactional id strings. - @r
thisobject
- @p
-
describeProducers (
list TopicPartitions)Describes the active idempotent/transactional producers of partitions.
- @p
TopicPartitionsis a list of topic-partition maps. - @r
Alist of { "topic", "partition", "producers": [{ "producerId", "producerEpoch", "lastSequence", "lastTimestamp" }] } maps.
- @p
-
listClientMetricsResources ()
Lists the client metrics subscription resources on the cluster (KIP-714).
- @r
Alist of resource name strings.
- @r