Re: kafka key serializer

2013-04-12 Thread Neha Narkhede
Correct, I should've been more specific. "key.serializer.class"
defaults to whatever "serializer.class" is set to.

Thanks,
Neha

On Fri, Apr 12, 2013 at 9:12 AM, Soby Chacko  wrote:
> Hi Neha,
>
> I could be understanding it wrong. I am looking at
> https://issues.apache.org/jira/browse/KAFKA-544 and see the following
> comment.
>
> This patch does the following:
> 1. Change Encoder and Decoder to map between object and byte[] rather than
> between Message and object.
> 2. Require two encoders for the producer and two decoders for the consumer.
> This follows the same pattern as before: in the producer there is now
> serializer.class and key.serializer.class. *By default key.serializer takes
> the same value as serializer.class*. If no key is specified then this
> parameter is essentially ignored. In the consumer ConsumerConnector now
> requires two decoders, one for the key and one for the value.
>
>
> So, if this is true, then doesn't that mean key.serializer gets default to
> whatever value serializer.class takes, not the DefaultEncoder?
>
> Thanks again,
> Soby Chacko
>
> On Fri, Apr 12, 2013 at 11:38 AM, Neha Narkhede 
> wrote:
>
>> It defaults both key and value serializer to DefaultEncoder, but you
>> can customize both independently through "key.serializer.class" and
>> "serializer.class" config options.
>>
>> Thanks,
>> Neha
>>
>> On Fri, Apr 12, 2013 at 8:33 AM, Soby Chacko  wrote:
>> > Thanks for the reply. But, when I did some more research, it seems like
>> its
>> > using the same encoder for both. For example, if I provide
>> serializer.class
>> > explicitly, this serializer is used for both key and value. However, if I
>> > don't specify any serializer, then it appears that Kafka defaults to
>> > DefaultEncoder. Is that what you ment?
>> >
>> > Thanks again!!
>> > Soby Chacko
>> >
>> >
>> > On Wed, Apr 10, 2013 at 1:59 PM, Neha Narkhede > >wrote:
>> >
>> >> It will use DefaultEncoder.
>> >>
>> >> Thanks,
>> >> Neha
>> >>
>> >> On Wed, Apr 10, 2013 at 8:27 AM, Soby Chacko 
>> wrote:
>> >> > If I don't provide an explicit key serializer but a serializer class
>> (for
>> >> > value encoding),  and then use a key in KeyedMessage, what will be the
>> >> > encoder used for key? Is it going to default to the same encoder used
>> for
>> >> > value or the DefaultEncoder?
>> >> >
>> >> > Thanks,
>> >> > Soby Chacko
>> >>
>>


Re: kafka key serializer

2013-04-12 Thread Soby Chacko
Hi Neha,

I could be understanding it wrong. I am looking at
https://issues.apache.org/jira/browse/KAFKA-544 and see the following
comment.

This patch does the following:
1. Change Encoder and Decoder to map between object and byte[] rather than
between Message and object.
2. Require two encoders for the producer and two decoders for the consumer.
This follows the same pattern as before: in the producer there is now
serializer.class and key.serializer.class. *By default key.serializer takes
the same value as serializer.class*. If no key is specified then this
parameter is essentially ignored. In the consumer ConsumerConnector now
requires two decoders, one for the key and one for the value.


So, if this is true, then doesn't that mean key.serializer gets default to
whatever value serializer.class takes, not the DefaultEncoder?

Thanks again,
Soby Chacko

On Fri, Apr 12, 2013 at 11:38 AM, Neha Narkhede wrote:

> It defaults both key and value serializer to DefaultEncoder, but you
> can customize both independently through "key.serializer.class" and
> "serializer.class" config options.
>
> Thanks,
> Neha
>
> On Fri, Apr 12, 2013 at 8:33 AM, Soby Chacko  wrote:
> > Thanks for the reply. But, when I did some more research, it seems like
> its
> > using the same encoder for both. For example, if I provide
> serializer.class
> > explicitly, this serializer is used for both key and value. However, if I
> > don't specify any serializer, then it appears that Kafka defaults to
> > DefaultEncoder. Is that what you ment?
> >
> > Thanks again!!
> > Soby Chacko
> >
> >
> > On Wed, Apr 10, 2013 at 1:59 PM, Neha Narkhede  >wrote:
> >
> >> It will use DefaultEncoder.
> >>
> >> Thanks,
> >> Neha
> >>
> >> On Wed, Apr 10, 2013 at 8:27 AM, Soby Chacko 
> wrote:
> >> > If I don't provide an explicit key serializer but a serializer class
> (for
> >> > value encoding),  and then use a key in KeyedMessage, what will be the
> >> > encoder used for key? Is it going to default to the same encoder used
> for
> >> > value or the DefaultEncoder?
> >> >
> >> > Thanks,
> >> > Soby Chacko
> >>
>


Re: kafka key serializer

2013-04-12 Thread Neha Narkhede
It defaults both key and value serializer to DefaultEncoder, but you
can customize both independently through "key.serializer.class" and
"serializer.class" config options.

Thanks,
Neha

On Fri, Apr 12, 2013 at 8:33 AM, Soby Chacko  wrote:
> Thanks for the reply. But, when I did some more research, it seems like its
> using the same encoder for both. For example, if I provide serializer.class
> explicitly, this serializer is used for both key and value. However, if I
> don't specify any serializer, then it appears that Kafka defaults to
> DefaultEncoder. Is that what you ment?
>
> Thanks again!!
> Soby Chacko
>
>
> On Wed, Apr 10, 2013 at 1:59 PM, Neha Narkhede wrote:
>
>> It will use DefaultEncoder.
>>
>> Thanks,
>> Neha
>>
>> On Wed, Apr 10, 2013 at 8:27 AM, Soby Chacko  wrote:
>> > If I don't provide an explicit key serializer but a serializer class (for
>> > value encoding),  and then use a key in KeyedMessage, what will be the
>> > encoder used for key? Is it going to default to the same encoder used for
>> > value or the DefaultEncoder?
>> >
>> > Thanks,
>> > Soby Chacko
>>


Re: kafka key serializer

2013-04-12 Thread Soby Chacko
Thanks for the reply. But, when I did some more research, it seems like its
using the same encoder for both. For example, if I provide serializer.class
explicitly, this serializer is used for both key and value. However, if I
don't specify any serializer, then it appears that Kafka defaults to
DefaultEncoder. Is that what you ment?

Thanks again!!
Soby Chacko


On Wed, Apr 10, 2013 at 1:59 PM, Neha Narkhede wrote:

> It will use DefaultEncoder.
>
> Thanks,
> Neha
>
> On Wed, Apr 10, 2013 at 8:27 AM, Soby Chacko  wrote:
> > If I don't provide an explicit key serializer but a serializer class (for
> > value encoding),  and then use a key in KeyedMessage, what will be the
> > encoder used for key? Is it going to default to the same encoder used for
> > value or the DefaultEncoder?
> >
> > Thanks,
> > Soby Chacko
>


Re: kafka key serializer

2013-04-10 Thread Neha Narkhede
It will use DefaultEncoder.

Thanks,
Neha

On Wed, Apr 10, 2013 at 8:27 AM, Soby Chacko  wrote:
> If I don't provide an explicit key serializer but a serializer class (for
> value encoding),  and then use a key in KeyedMessage, what will be the
> encoder used for key? Is it going to default to the same encoder used for
> value or the DefaultEncoder?
>
> Thanks,
> Soby Chacko


kafka key serializer

2013-04-10 Thread Soby Chacko
If I don't provide an explicit key serializer but a serializer class (for
value encoding),  and then use a key in KeyedMessage, what will be the
encoder used for key? Is it going to default to the same encoder used for
value or the DefaultEncoder?

Thanks,
Soby Chacko