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

Claus Ibsen commented on CAMEL-10586:
-------------------------------------

Antonie, yeah that is a good idea. This is done now, so based on what 
serializer class configured it attempts to convert to that type first, such as 
string, byte[] and so forth.

It would have been nicer if we made configuring those serializer/deserializer 
easier with 

serialize=string | byte[] | custom
deserialize = string | byte[] | custom

then its was an enum of those, and if you want custom you just set it to custom 
and then those FQN class name must be configured in all those options.

What about they key, when would you use a different serialize / deserialize 
than the message body itself? Currently its using the same as the body. But are 
there use-cases where you use a Long key instead of just String ?

> make the kafka endpoint a little easier to use
> ----------------------------------------------
>
>                 Key: CAMEL-10586
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10586
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-kafka
>            Reporter: james strachan
>            Assignee: Claus Ibsen
>             Fix For: 2.19.0
>
>
> when using, say, JMS or activemq endpoints you can send text to a destination 
> and it all kinda works OOTB. However it seems pretty hard to actually send 
> anyhting to the kafka endpoint. 
> I wonder if we could do a bit more to make it easier to use as a camel 
> endpoint?
> e.g. if I invoke a HTTP endpoint then pipe the result to Kafka I get:
> {code}
> org.apache.kafka.common.errors.SerializationException: Can't convert value of 
> class org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream 
> to class org.apache.kafka.common.serialization.StringSerializer specified in 
> value.serializer
> {code}
> seems like it'd be nice if there's no configured serializer to assume its 
> bytes / string?
> If I send to the dataformat endpoint first to force conversion to a String:
> {code}
> to("dataformat:string:unmarshal").
> to("kafka://kafka:9092?topic=cheese&groupId=group1")
> {code}
> then I get: 
> {code}
> 17:34:10.212 [Camel (Funktion) thread #0 - timer://foo] WARN  
> o.a.c.component.kafka.KafkaProducer - No message key or partition key set
> {code}
> and there's no easy way to pass in a message key or partition key via the URI 
> parameters from what I can see. 
> I wonder if we should support a URI parameter for setting the partition key + 
> message key?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to