You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
binding-kafka: add OffsetDelete (v0) wire codecs to the public api package #3173
binding-kafka exposes typed wire codecs for a set of Kafka request/response pairs in its public io.aklivity.zilla.runtime.binding.kafka.api package (for example KafkaFindCoordinatorRequest with a Generator, KafkaFindCoordinatorResponseV3FW, KafkaListOffsetsRequest, KafkaListOffsetsResponseV6FW, KafkaOffsetFetchRequest, KafkaOffsetFetchResponseV6FW). They are used together with the raw API request/response streams (KafkaApiRequestBeginEx / KafkaApiResponseBeginEx), where the caller encodes and decodes the Kafka wire frames itself.
There is no codec for OffsetDelete (API key 47), the Kafka request that removes the committed offsets of a consumer group for given topic partitions. In this repository OffsetDelete appears only as a value of the event KafkaApiKey enum. Committing a chosen offset is not a substitute: it needs a target offset per partition and there is no sentinel meaning "no committed offset".
Expected
KafkaOffsetDeleteRequest (with sizeof, a Source and a Generator) and KafkaOffsetDeleteResponse / KafkaOffsetDeleteResponseV0FW, in the same package and with the same structure and naming as the FindCoordinator and ListOffsets codecs.
OffsetDelete version 0 only, laid out per the Kafka protocol definition (OffsetDeleteRequest.json / OffsetDeleteResponse.json): version 0 is not a flexible version, so strings carry an int16 length, arrays an int32 count and there are no tagged fields; the request uses header v1 and the response header v0.
The response codec exposes the top-level error code, the throttle time, and the per-partition error codes.
Unit tests in the style of KafkaFindCoordinatorRequestTest / KafkaFindCoordinatorResponseV3FWTest, written first.
Out of scope
No change to kafka.idl, no new application stream type, no client factory.
DeleteGroups (API key 42) is not covered: it is a separate request, and it is rejected by the broker for a group that has active members. It can be proposed separately.
Test plan (test-first)
Golden-byte unit tests for the request generator (generate, sizeof, count mismatch, buffer too small, unsupported version) and the response decoder (per-partition errors, top-level error). The tests are committed first and fail before the codec exists.
The newer one-shot admin streams under KafkaApi.REQUEST / RESPONSE (nested sub-union keyed by Kafka api key), specifically KafkaClientDeleteTopicsFactory (KafkaDeleteTopicsRequestBeginEx / KafkaDeleteTopicsResponseBeginEx, routed by KafkaClientRequestFactory). Two things are taken from the legacy group streams, because DeleteTopics has no equivalent:
the coordinator is addressed by host / port in the begin extension, as KafkaOffsetFetchBeginEx and KafkaOffsetCommitBeginEx do (and the network side reads the proxy begin ex for that address);
a group-level error code that applies to the whole response becomes RESET with KafkaResetEx.error, as KafkaClientOffsetFetchFactory does through onDecodeResponseErrorCode and cleanupApplication.
No cache client/server change and no KafkaClientFactory change: both new streams are REQUEST sub-kinds, so only KafkaClientRequestFactory registers them.
Scope: both operations, as two sub-kinds
OffsetDelete (47) and DeleteGroups (42) are different requests with different results, so each is its own REQUEST sub-kind and its own client factory, rather than one stream with a mode flag. The issue asks for "the committed offsets ... or the group", so both are covered. The two are independent; if preferred the second can follow in a separate change.
No data and no flush extension, and no new reset struct (KafkaResetEx.error already exists).
protocol.idl (runtime wire codecs): new codec.offset_delete and codec.delete_groups scopes, following codec.delete_topics.
KafkaFunctions (spec project): builders and matchers for the four extensions, plus KafkaFunctionsTest cases.
Stream lifecycle (identical to DeleteTopics)
Application BEGIN with the request extension. Client opens the network side, sends the request (after SASL handshake/authenticate when configured), grants a zero-credit WINDOW.
Application DATA is not allowed (half-duplex): cleanup, as DeleteTopics does.
Response decoded; client sends the reply BEGIN carrying the response extension, then END when the network ends.
Application ABORT / RESET propagate to the network side.
Error mapping
Condition
Result
Per-partition error in OffsetDelete (e.g. GROUP_SUBSCRIBED_TO_TOPIC 86, UNKNOWN_TOPIC_OR_PARTITION 3)
reply BEGIN partitions[].error, then END (like DeleteTopics per-item status)
RESET with KafkaResetEx.error = code, then ABORT, plus the existing onDecodeResponseErrorCode event (the OffsetFetch behavior)
SASL failure, unsupported version, transport failure, malformed response
RESET with KafkaResetEx.error, then ABORT (existing cleanupApplication / decodeReject behavior)
Group with active members
Not handled specially in the client: the broker decides and the result is reported, never retried or worked around. DeleteGroups on a non-empty group yields NON_EMPTY_GROUP in that group's status; OffsetDelete for a topic the active group is subscribed to yields GROUP_SUBSCRIBED_TO_TOPIC for those partitions, while partitions the group is not subscribed to are deleted in the same request. Both are therefore visible per item to the caller.
Kafka protocol versions
OffsetDelete: v0, the only version defined, non-flexible.
DeleteGroups: v2, the highest version defined and the first flexible one (compact strings, tagged fields), the same encoding style as DeleteTopics v6. Older versions (v0, v1) are not supported.
Paired client.rpt / server.rpt under streams/application/offset.delete/* and delete.groups/*, and streams/network/offset.delete.v0/* and delete.groups.v2/* (each with a SASL variant only if DeleteTopics has one for the same scenario): success, per-partition error / per-group error (active members), group-level error (RESET), and a rejected request. Spec ITs per side (ApplicationIT-style classes beside the neighbours, OffsetDeleteIT, DeleteGroupsIT) and the matching runtime ITs in binding-kafka.
changed the title [-]binding-kafka: delete the committed offsets of a consumer group[/-][+]binding-kafka: add OffsetDelete (v0) wire codecs to the public api package[/+]on Nov 12, 2026
Revised design (supersedes the earlier design comment)
The earlier proposal (new REQUEST/RESPONSE sub-kinds in kafka.idl with dedicated client factories) is withdrawn. The module's direction is separate per-API handling over the raw API streams, with the Kafka wire frames encoded and decoded by typed codecs in the public api package, so OffsetDelete follows that. The issue title and body are rewritten accordingly.
Mirrored
KafkaFindCoordinatorRequest / KafkaFindCoordinatorResponse / KafkaFindCoordinatorResponseV3FW for naming, the sizeof + Generator shape, and the hand-crafted response view over generated protocol.idl flyweights.
KafkaListOffsetsRequest / KafkaListOffsetsResponse / KafkaListOffsetsResponseV6FW for the nested topic/partition shape: a Source + Generator + Topic builder for the request and a topic/partition cursor (hasNext() / next()) for the response, because OffsetDelete is also a topic-then-partition array.
Activity
jfallows commentedon Nov 12, 2026
Design
Pattern mirrored
The newer one-shot admin streams under
KafkaApi.REQUEST/RESPONSE(nested sub-union keyed by Kafka api key), specificallyKafkaClientDeleteTopicsFactory(KafkaDeleteTopicsRequestBeginEx/KafkaDeleteTopicsResponseBeginEx, routed byKafkaClientRequestFactory). Two things are taken from the legacy group streams, because DeleteTopics has no equivalent:host/portin the begin extension, asKafkaOffsetFetchBeginExandKafkaOffsetCommitBeginExdo (and the network side reads the proxy begin ex for that address);KafkaResetEx.error, asKafkaClientOffsetFetchFactorydoes throughonDecodeResponseErrorCodeandcleanupApplication.No cache client/server change and no
KafkaClientFactorychange: both new streams areREQUESTsub-kinds, so onlyKafkaClientRequestFactoryregisters them.Scope: both operations, as two sub-kinds
OffsetDelete (47) and DeleteGroups (42) are different requests with different results, so each is its own
REQUESTsub-kind and its own client factory, rather than one stream with a mode flag. The issue asks for "the committed offsets ... or the group", so both are covered. The two are independent; if preferred the second can follow in a separate change.kafka.idl additions (
specs/binding-kafka.spec/.../kafka.idl)KafkaApi: addOFFSET_DELETE (47)andDELETE_GROUPS (42).case 47/case 42inKafkaRequestBeginEx):KafkaOffsetDeleteRequestBeginEx { string16 groupId; string16 host; int32 port; KafkaOffsetDeleteTopic[] topics; }withKafkaOffsetDeleteTopic { string16 name; KafkaTopicPartition[] partitions; }KafkaDeleteGroupsRequestBeginEx { string16 host; int32 port; string16[] groupIds; }KafkaResponseBeginEx), carrying the whole result as DeleteTopics does:KafkaOffsetDeleteResponseBeginEx { int32 throttle; KafkaOffsetDeleteTopicStatus[] topics; }withKafkaOffsetDeleteTopicStatus { string16 name; KafkaOffsetDeletePartitionStatus[] partitions; }andKafkaOffsetDeletePartitionStatus { int32 partitionId; int16 error; }KafkaDeleteGroupsResponseBeginEx { int32 throttle; KafkaDeleteGroupStatus[] groups; }withKafkaDeleteGroupStatus { string16 groupId; int16 error; }KafkaResetEx.erroralready exists).protocol.idl(runtime wire codecs): newcodec.offset_deleteandcodec.delete_groupsscopes, followingcodec.delete_topics.KafkaFunctions(spec project): builders and matchers for the four extensions, plusKafkaFunctionsTestcases.Stream lifecycle (identical to DeleteTopics)
Error mapping
GROUP_SUBSCRIBED_TO_TOPIC86,UNKNOWN_TOPIC_OR_PARTITION3)partitions[].error, then END (like DeleteTopics per-item status)NON_EMPTY_GROUP68,GROUP_ID_NOT_FOUND69,NOT_COORDINATOR16)groups[].error, then ENDGROUP_AUTHORIZATION_FAILED30,COORDINATOR_NOT_AVAILABLE15,GROUP_ID_NOT_FOUND69,INVALID_GROUP_ID24)KafkaResetEx.error = code, then ABORT, plus the existingonDecodeResponseErrorCodeevent (the OffsetFetch behavior)KafkaResetEx.error, then ABORT (existingcleanupApplication/decodeRejectbehavior)Group with active members
Not handled specially in the client: the broker decides and the result is reported, never retried or worked around. DeleteGroups on a non-empty group yields
NON_EMPTY_GROUPin that group's status; OffsetDelete for a topic the active group is subscribed to yieldsGROUP_SUBSCRIBED_TO_TOPICfor those partitions, while partitions the group is not subscribed to are deleted in the same request. Both are therefore visible per item to the caller.Kafka protocol versions
KafkaClientDeleteTopicsFactory(DELETE_TOPICS_API_VERSION = 6); a broker that does not support it answers with an error that becomes a RESET. I will check the exact layouts and versions against https://kafka.apache.org/protocol before writing the scripts.Test plan
Paired
client.rpt/server.rptunderstreams/application/offset.delete/*anddelete.groups/*, andstreams/network/offset.delete.v0/*anddelete.groups.v2/*(each with a SASL variant only if DeleteTopics has one for the same scenario): success, per-partition error / per-group error (active members), group-level error (RESET), and a rejected request. Spec ITs per side (ApplicationIT-style classes beside the neighbours,OffsetDeleteIT,DeleteGroupsIT) and the matching runtime ITs inbinding-kafka.Generated by Claude Code
[-]binding-kafka: delete the committed offsets of a consumer group[/-][+]binding-kafka: add OffsetDelete (v0) wire codecs to the public api package[/+]jfallows commentedon Nov 12, 2026
Revised design (supersedes the earlier design comment)
The earlier proposal (new
REQUEST/RESPONSEsub-kinds inkafka.idlwith dedicated client factories) is withdrawn. The module's direction is separate per-API handling over the raw API streams, with the Kafka wire frames encoded and decoded by typed codecs in the publicapipackage, so OffsetDelete follows that. The issue title and body are rewritten accordingly.Mirrored
KafkaFindCoordinatorRequest/KafkaFindCoordinatorResponse/KafkaFindCoordinatorResponseV3FWfor naming, thesizeof+Generatorshape, and the hand-crafted response view over generatedprotocol.idlflyweights.KafkaListOffsetsRequest/KafkaListOffsetsResponse/KafkaListOffsetsResponseV6FWfor the nested topic/partition shape: aSource+Generator+Topicbuilder for the request and a topic/partition cursor (hasNext()/next()) for the response, because OffsetDelete is also a topic-then-partition array.Classes (package
io.aklivity.zilla.runtime.binding.kafka.api)KafkaOffsetDeleteRequest:sizeof(Source, short)(version 0 only, otherwiseUnsupportedOperationException),Source,Generator.generate(Source)and the incrementaltopics(groupId, count)/topic().name().partitions().partition()/build().KafkaOffsetDeleteResponse: cursor interface witherror()(top-level),throttleTimeMillis(),topicCount(),TopicandPartition(partitionIndex(),errorCode()).KafkaOffsetDeleteResponseV0FW: the v0 decoder.protocol.idl: newoffset_deletecodec scope (non-flexible:string16,int32counts, no tagged fields).Protocol layout used (v0, from the Kafka protocol message definitions
OffsetDeleteRequest.json/OffsetDeleteResponse.json)group_idSTRING;topicsARRAY of {nameSTRING;partitionsARRAY of {partition_indexINT32 } }.error_codeINT16;throttle_time_msINT32;topicsARRAY of {nameSTRING;partitionsARRAY of {partition_indexINT32;error_codeINT16 } }.Tests
KafkaOffsetDeleteRequestTestandKafkaOffsetDeleteResponseV0FWTest, golden bytes in the same style as the FindCoordinator and ListOffsets tests.Generated by Claude Code