camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-8409) Kafka producer: when no message key specified, use partition key
Date Thu, 26 Feb 2015 09:09:04 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-8409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14338118#comment-14338118
] 

Claus Ibsen commented on CAMEL-8409:
------------------------------------

Thanks will get the patch in, but for #3 can we not thrown an exception instead of logging
a warn?

> Kafka producer: when no message key specified, use partition key
> ----------------------------------------------------------------
>
>                 Key: CAMEL-8409
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8409
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kafka
>    Affects Versions: 2.14.2, 2.15.0
>            Reporter: Mark Mindenhall
>            Priority: Critical
>         Attachments: 0001-CAMEL-8409-fix-for-breaking-change-introduced-by-CAM.patch
>
>
> CAMEL-8190 has introduced behavior that has the potential to break existing code (hence
setting to Critical priority so this can be fixed prior to 2.14.2/2.15.0 releases).  It broke
my code (using 2.14.2-SNAPSHOT builds) in development and staging, and I didn't notice the
problem until tonight.
> Prior to CAMEL-8190, the value of the {{KafkaConstants.PARTITION_KEY}} header was used
for both the {{key}} and {{partitionKey}} of the kafka {{KeyedMessage}}.  My downstream consumers
depended on this for the correct {{key}} of the consumed message.  CAMEL-8190, changed things
so the {{key}} is set only via the {{KafkaConstants.KEY}} header, and since my code didn't
set that header, the {{key}} started coming through as {{null}} to downstream consumers.
> I propose the following to fix this (will attach a patch shortly):
> # If both {{KEY}} _and_ {{PARTITION_KEY}} are specified, no change from CAMEL-8190
> # If just one is specified, call the {{KeyedMessage}} 3-argument constructor with the
value (uses the value for both {{key}} and {{partitionKey}})
> # If neither are specified, pass {{null}} for both...but IMHO, a warning should be logged,
as it seems unlikely that the user knowingly omitted both values.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message