Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C97C11761A for ; Tue, 23 Jun 2015 05:43:00 +0000 (UTC) Received: (qmail 30763 invoked by uid 500); 23 Jun 2015 05:43:00 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 30722 invoked by uid 500); 23 Jun 2015 05:43:00 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 30712 invoked by uid 99); 23 Jun 2015 05:43:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2015 05:43:00 +0000 Date: Tue, 23 Jun 2015 05:43:00 +0000 (UTC) From: "Willem Jiang (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-8790) Kafka producer hard coded to use Strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-8790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14597201#comment-14597201 ] Willem Jiang commented on CAMEL-8790: ------------------------------------- It's a new feature, we normally don't add a new feature to the patched release branch. I will take a look at this issue this week. > Kafka producer hard coded to use Strings > ---------------------------------------- > > Key: CAMEL-8790 > URL: https://issues.apache.org/jira/browse/CAMEL-8790 > Project: Camel > Issue Type: Improvement > Components: camel-kafka > Affects Versions: 2.14.2, 2.15.2, 2.16.0 > Reporter: Mark Mindenhall > Assignee: Willem Jiang > Fix For: 2.16.0 > > Attachments: 0001-CAMEL-8790-Fix-for-Kafka-producer-hard-coded-to-use-.patch > > > Kafka natively supports two encoders for messages: > # {{kafka.serializer.DefaultEncoder}} - encodes as byte arrays > # {{kafka.serializer.StringEncoder}} - encodes as Strings > Camel-kafka exposes settings to select the encoder (({{serializerClass}} and {{keySerializerClass}}), but the {{org.apache.camel.component.kafka.KafkaProducer}} class hard-codes String for both the key and value types. This results in a {{ClassCastException}} when using the {{DefaultDecoder}}. > The attached patch fixes this as follows (conforming to kafka itself): > * If no {{serializerClass}} option is specified, the {{DefaultDecoder}} is used. > * If no {{keySerializerClass}} option is specified, the same encoder as {{serializerClass}} is used > This fix shouldn't break any existing code, as there was not previously a default setting (i.e., {{StringEncoder}} always had to be specified). > I created the patch against master, but it should backport easily to 2.15.x and 2.14.x. -- This message was sent by Atlassian JIRA (v6.3.4#6332)