I have a test class where I want to test two topologies. For this scenario, I am creating two TopologyTestDriver instances with those topologies.
One of my topologies is creating a stream from avro and producing avro, which is working fine. Other one should read json and produce an avro. This one is failing with this exception
org.apache.kafka.common.errors.SerializationException: Error serializing JSON message
this happens when i call
topic.pipeInput("key", messageObject);
my inputTopic is created like this
jsonTopic = driver.createInputTopic( "jsonTopic", stringSerde.serializer(), messageSerde.serializer());
And this is how I create my messageSerde:
final Serde<Message> messageSerde = Serdes.serdeFrom(
new SchemaRegistrySerializer<>(Message.class, kafkaConfig),
new SchemaRegistryDeserializer<>(Message.class, kafkaConfig));
Map<String, String> config = Map.of(
AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, MOCK_SCHEMA_REGISTRY_URL);
messageSerde.configure(config, false);
Also, my KafkaConfig:
I tried everything and I cannot make it work with the json topology :D Thanks a lot!
Tried to initialiaze different serdes, even used objectMapper and JsonSerializer class but still not working.