You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/15 17:16:25 UTC
[jira] [Commented] (KAFKA-3563) Maintain MessageAndMetadata
constructor compatibility
[ https://issues.apache.org/jira/browse/KAFKA-3563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15243088#comment-15243088 ]
ASF GitHub Bot commented on KAFKA-3563:
---------------------------------------
GitHub user granthenke opened a pull request:
https://github.com/apache/kafka/pull/1226
KAFKA-3563: Maintain MessageAndMetadata constructor compatibility
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/granthenke/kafka message_constructor
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/1226.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1226
----
commit cf6b651dac2dc87ccb85b9c6c63e8010d9067818
Author: Grant Henke <gr...@gmail.com>
Date: 2016-04-15T14:59:13Z
KAFKA-3563: Maintain MessageAndMetadata constructor compatibility
----
> Maintain MessageAndMetadata constructor compatibility
> ------------------------------------------------------
>
> Key: KAFKA-3563
> URL: https://issues.apache.org/jira/browse/KAFKA-3563
> Project: Kafka
> Issue Type: Improvement
> Affects Versions: 0.10.0.0
> Reporter: Grant Henke
> Assignee: Grant Henke
> Fix For: 0.10.0.0
>
>
> The MessageAndMetadata constructor was changed to include timestamp information as a part of KIP-32. Though the constructor may not be used in general client usage, it may be used in unit tests or some advanced usage. We should maintain compatibility if possible.
> One example where the constructor is used is Apache Spark: https://github.com/apache/spark/blob/master/external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaRDD.scala#L223-L225
> The old constructor was:
> {code}
> MessageAndMetadata[K, V](topic: String,
> partition: Int,
> private val rawMessage: Message,
> offset: Long,
> keyDecoder: Decoder[K], valueDecoder: Decoder[V])
> {code}
> And after KIP-32 it is now:
> {code}
> MessageAndMetadata[K, V](topic: String,
> partition: Int,
> private val rawMessage: Message,
> offset: Long,
> timestamp: Long = Message.NoTimestamp,
> timestampType: TimestampType = TimestampType.CREATE_TIME,
> keyDecoder: Decoder[K], valueDecoder: Decoder[V])
> {code}
> Even though _timestamp_ and _timestampType_ have defaults, if _keyDecoder_ and _valueDecoder_ were not accessed by name, then the new constructor is not backwards compatible.
> We can fix compatibility by moving the _timestamp_ and _timestampType_ parameters to the end of the constructor, or by providing a new constructor without _timestamp_ and _timestampType_ that matches the old constructor.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)