...
- using RQ/RP wire protocol to the controller instead of the current way (via ZK admin path) may expose concurrency on the admin requests, which may not be supported yet. https://issues.apache.org/jira/browse/KAFKA-1305
Proposed RQ/RP Format
For each type of Admin Request a separate type of Wire protocol message is created.
Currently there are 5 types of messages which support TopicCommand - CreateTopic(Request | Response)
, AlterTopic
, DeleteTopic
, DescribeTopic
, ListTopics
. And a special message type to identify cluster info - ClusterMetadata
(read Kafka Admin Command Line Internals for details).
The same notation as in A Guide To The Kafka Protocol is used here. The only difference - new Kafka Protocol metatype - MaybeOf
("
?"
in notation), when used means value is optional in message. To define value existence special control byte is prepended before each value (0
- field is absent, otherwise - read value normally).
Create Topic Request
CreateTopicRequest => TopicName ?(Partitions) ?(Replicas) ?(ReplicaAssignment) [Config] TopicName => string Partitions => int32 Replicas => int32 ReplicaAssignment => string |
Create Topic Response
CreateTopicResponse => ErrorCode ?(ErrorDescription) ErrorCode => int16 ErrorDescription => string |
CreateTopicRequest
requires topic name and either (partitions+replicas) or replicas assignment to create topic (validation is done on server side). You can also specify topic-level configs to create topic with (to use default set an empty array), format key=value
.
CreateTopicResponse
is fairly simple - you receive error code (0
as always identifies NO_ERROR
) and optionally error description. Usually it will hold the higher level exception that happened during command execution.
Alter Topic Request
AlterTopicRequest => TopicName ?(Partitions) ?(ReplicaAssignment) [AddedConfig] [DeletedConfig] TopicName => string Partitions => int32 Replicas => int32
Deleted Config => string |
Alter Topic Response
AlterTopicResponse => ErrorCode ?(ErrorDescription) ErrorCode => int16 ErrorDescription => string
|
AlterTopicRequest
is similar to previous, to specify topic level settings that should be removed, use DeletedConfig
array (just setting keys).AlterTopicResponse
is similar to CreateTopicResponse
.
Delete Topic Request
DeleteTopicRequest => TopicName TopicName => string |
Delete Topic Response
DeleteTopicResponse => ErrorCode ?(ErrorDescription) ErrorCode => int16 ErrorDescription => string
|
DeleteTopicRequest
requires only topic name which should be deleted.
DeleteTopicResponse
is similar to CreateTopicResponse
.