[ 
https://issues.apache.org/jira/browse/KAFKA-16738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhenyu Luo updated KAFKA-16738:
-------------------------------
    Description: 
We can write a record which is a subtype of 
[BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java],
 but we can not read a record which is a subtype of 
[BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java].
 If we change the return type of 
[Readable#readRecords|https://github.com/apache/kafka/blob/5439914c32fa00d634efa7219699f1bc21add839/clients/src/main/java/org/apache/kafka/common/protocol/Readable.java#L56]
 from MemoryRecords to BaseRecords, we can override the implementation of 
readRecords and returns a subtype of BaseRecords easily.

We known that the MemoryRecords is based on JDK's ByteBuffer. We are developing 
a netty project([kroxylicious|https://github.com/kroxylicious/kroxylicious/]) 
and we want to create a subtype of BaseRecords like MemoryRecords based on 
netty's ByteBuf.


  was:
We can write a record which is a subtype of 
[BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java],
 but we can not read a record which is a subtype of 
[BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java].
 If we change the return type of 
[Readable#readRecords|https://github.com/apache/kafka/blob/5439914c32fa00d634efa7219699f1bc21add839/clients/src/main/java/org/apache/kafka/common/protocol/Readable.java#L56]
 from MemoryRecords to BaseRecords, we can override the implementation of 
readRecords easily.

We known that the MemoryRecords is based on JDK's ByteBuffer. We are developing 
a netty project([kroxylicious|https://github.com/kroxylicious/kroxylicious/]) 
and we want to create a subtype of BaseRecords like MemoryRecords based on 
netty's ByteBuf.



> Returns BaseRecords instead of MemoryRecords
> --------------------------------------------
>
>                 Key: KAFKA-16738
>                 URL: https://issues.apache.org/jira/browse/KAFKA-16738
>             Project: Kafka
>          Issue Type: Improvement
>          Components: protocol
>            Reporter: Zhenyu Luo
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> We can write a record which is a subtype of 
> [BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java],
>  but we can not read a record which is a subtype of 
> [BaseRecords|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/BaseRecords.java].
>  If we change the return type of 
> [Readable#readRecords|https://github.com/apache/kafka/blob/5439914c32fa00d634efa7219699f1bc21add839/clients/src/main/java/org/apache/kafka/common/protocol/Readable.java#L56]
>  from MemoryRecords to BaseRecords, we can override the implementation of 
> readRecords and returns a subtype of BaseRecords easily.
> We known that the MemoryRecords is based on JDK's ByteBuffer. We are 
> developing a netty 
> project([kroxylicious|https://github.com/kroxylicious/kroxylicious/]) and we 
> want to create a subtype of BaseRecords like MemoryRecords based on netty's 
> ByteBuf.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to