I have producer and consumer configuration
Producer
@Bean
public KafkaTemplate<String, BeltEventDescription> kafkaBeltEventDescriptionTemplate(final ProducerFactory<String, BeltEventDescription> producerFactory) {
return new KafkaTemplate<>(producerFactory);
}
with config properties
@Bean
public ProducerFactory<String, BeltEventDescription> producerBeltEventDescriptionFactory() {
return new DefaultKafkaProducerFactory<>(Map.of(
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress,
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class,
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class
));
}
Consumer
@Bean
public KafkaConsumer<String, String> kafkaStringConsumer() {
return new KafkaConsumer<>(consumerFactory(beltGroupId).getConfigurationProperties());
}
with config props
private ConsumerFactory<String, BeltEvent> consumerFactory(final String groupId) {
return new DefaultKafkaConsumerFactory<>(Map.of(
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress,
ConsumerConfig.GROUP_ID_CONFIG, groupId,
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class,
ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class,
ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, 1000,
ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 10000,
ConsumerConfig.GROUP_INSTANCE_ID_CONFIG, ("SchedulerCoordinator-" + UUID.randomUUID()))
);
}
but when I try sending message or listening, I don't know what fails exactly, I get the message
Listener failed No method found for class java.lang.String
What's wrong?