I am writing a junit test case using embedded kafka. We have a pipeline where producer > topic > consumer > do work() > produce . I am using a third party schema registry(a mock of this is used for my test by giving a fake url ) and the specific serdes tied to it .After discussing this on kafka user group the way to do this was to use a a mock registry to serialize the data manually and pass byte[] itself in the producer instead of the avro record . How ever my consumer will fail in this case since it is expecting a specific record payload.Any ideas on how to workaround this?
//Listener method
*/
@KafkaListener(topics = test1,id="tesId1")
public void onMessage(@Payload Log log,
@Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition,
@Header(KafkaHeaders.OFFSET) Long offset) throws Exception
{
}
// test class
@RunWith(SpringRunner.class)
@SpringBootTest
@DirtiesContext
@EmbeddedKafka(topics = { "test1" })
@TestPropertySource(properties = { "spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}" })
public class ConsumerTests {
}