There has to be an implicit contract between the producer and
consumer. The K, V pairs don't _need_ to match but generally _should_.
If producer sends with <PK, PV> the consumer may receive <CK, CV> as
long as it knows how to convert those raw bytes to <CK, CV>. In the
example if CK == byte[] and CV == byte[] it is effectively a no-op
conversion.

On Thu, Feb 05, 2015 at 12:11:03PM -0800, Yang wrote:
> in the example
> https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example
> 
> we use a String,String for <K,V>
> 
> in the same set of example
> https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example
> 
> on the consumer side we use byte[], byte[] for K,V
>         ConsumerIterator<byte[], byte[]> it = m_stream.iterator();
> 
> 
> 
> we tested in our own code that the above producer-consumer pair does work.
> 
> 
> so the K,V types on the 2 sides do NOT need to match? if we argue that
> "everything has to come down to byte[], then maybe we don't need the
> generics types on the consumer side? in other words, how do we determine
> the K,V types on consumer side?
> 
> thanks
> Yang

Reply via email to