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

Willem Jiang commented on CAMEL-8754:
-------------------------------------

If you take a look at the definition of the kafka.javaapi.producer.Producer, 
Producer<String, String> producer;
You can see it just take the Message Key with String and Message Value with 
String.
It makes sense that we need to take the message body as a String, it is not 
String, camel type converter can help us turn it into String.
{code}
String msg = exchange.getIn().getBody(String.class);
{code}

I don't think we can change the code as you suggest, because you can only send 
the message body which type is String.

> camel-kafka prevents sending anything other than String
> -------------------------------------------------------
>
>                 Key: CAMEL-8754
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8754
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kafka
>    Affects Versions: 2.15.2
>            Reporter: Valentin Mayamsin
>
> Due to incorrect camel-kafka Producer implementation, it prevents sending 
> anything other than String. See 
> https://github.com/apache/camel/blob/a7dfc45097a610dca1a39c86f481182efc20e152/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java#L72
> {code}
> String msg = exchange.getIn().getBody(String.class);
> {code}
> Apparently it should be something like
> {code}
> Object msg = exchange.getIn().getBody();
> {code}



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

Reply via email to