[
https://issues.apache.org/jira/browse/KAFKA-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13971821#comment-13971821
]
Sharmarke Aden edited comment on KAFKA-1049 at 4/16/14 7:20 PM:
----------------------------------------------------------------
What exactly is the value of VerifiableProperties? Why would you want to
implicitly drive implementation details of Encoder/Decoder interfaces? If you
really need to make VerifiableProperties available to encoder/decoder
implementations then pass it in via toBytes/fromBytes methods.
This issue is a major API flaw. Please fix it as soon as possible.
{code}
public interface Encoder<T> {
public byte[] toBytes(T object, VerifiableProperties properties);
}
public interface Decoder<T> {
public T fromBytes(byte[] buffer, VerifiableProperties properties);
}
{code}
was (Author: saden1):
What exactly is the value of VerifiableProperties? Why would you want to
implicitly drive implementation details of Encoder/Decoder interfaces? If you
really need to make VerifiableProperties available to encoder/decoder
implementations then pass it in via toBytes/fromBytes methods.
This issue is a major API flaw. Please fix it as soon as possible.
> Encoder implementations are required to provide an undocumented constructor.
> ----------------------------------------------------------------------------
>
> Key: KAFKA-1049
> URL: https://issues.apache.org/jira/browse/KAFKA-1049
> Project: Kafka
> Issue Type: Improvement
> Reporter: Jason Rosenberg
> Priority: Minor
> Attachments: KAFKA-1049.patch
>
>
> So, it seems that if I want to set a custom serializer class on the producer
> (in 0.8), I have to use a class that includes a special constructor like:
> public class MyKafkaEncoder<MyType> implements Encoder<MyType> {
> // This constructor is expected by the kafka producer, used by reflection
> public MyKafkaEncoder(VerifiableProperties props) {
> // what can I do with this?
> }
> @Override
> public byte[] toBytes(MyType message) {
> return message.toByteArray();
> }
> }
> It seems odd that this would be a requirement when implementing an interface.
> This seems not to have been the case in 0.7.
> What could my encoder class do with the VerifiableProperties?
--
This message was sent by Atlassian JIRA
(v6.2#6252)