I am new to camel and kafka.
I am using Camel 2.18.2 with Kafka 0.10.1.1
I am getting this error and don't understand why:
org.apache.kafka.common.errors.SerializationException: Can't convert value
of class [B to class org.apache.kafka.common.serialization.StringSerializer
specified in value.serializer
I have the following route:
from("direct://toEnrichEmail")
.routeId(routeId).marshal().json(JsonLibrary.Jackson, Map.class)
.log(LoggingLevel.INFO, "Sending to Kafka: ${body}")
.to("kafka:localhost:9092?topic=enrich-email&requestRequiredAcks=-1");
The code that actually sends to the route:
ProducerTemplate template =
kafkaProducerFactory.getProducerTemplate();
logger.debug("Sending message type: {}, to uri: {}, route: {}",
wimsConfiguration.getMessageType(),
wimsConfiguration.getDirectUri(),
wimsConfiguration.getRouteName());
Map<String,Object>headers = new HashMap<>(); // added because
the examples
do
headers.put(KafkaConstants.PARTITION_KEY, 0);
headers.put(KafkaConstants.KEY, "1");
template.sendBodyAndHeaders(wimsConfiguration.getDirectUri(),
wimsConfiguration.getWimsMessage(), headers);
The log message in the route shows that the message is a proper JSON string,
the default serializer is string, So why is it complaining that it cannot
serialize?
I looked through the camel kafka component test cases and this looks like it
should work
--
View this message in context:
http://camel.465427.n5.nabble.com/Kafka-Producer-Serialization-Error-tp5793630.html
Sent from the Camel - Users mailing list archive at Nabble.com.