1
votes

I'm using Axon version (4.3) which seamlessly supports Kafka with annotation in the SpringBoot Main class using

@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration.class)

In my case the message is sotred in the topic successfully, but the problem with this consumer, i can't consume the message from the topic.

y a-t-il une configuration manquante?

 <dependency>
   <groupId>org.axonframework</groupId>
   <artifactId>axon-spring-boot-starter</artifactId>
   <version>4.3</version>
   <exclusions>
     <exclusion>
        <groupId>org.axonframework</groupId>
        <artifactId>axon-server-connector</artifactId>
     </exclusion>
   </exclusions>
 </dependency>
 <dependency>
   <groupId>org.springframework.kafka</groupId>
   <artifactId>spring-kafka</artifactId>
 </dependency>
 <dependency>
   <groupId>org.axonframework.extensions.kafka</groupId>
   <artifactId>axon-kafka-spring-boot-starter</artifactId>
   <version>4.0-RC3</version>
 </dependency>

application.yml

axon:
  eventhandling:
    processors:
      conventions:
        source: kafkaMessageSource
        mode: tracking
  serializer:
    general: jackson
  kafka:
    client-id: consumer_service
    default-topic: topic_x
    bootstrap-servers:
    - 127.0.0.1:9092

Listener.java

//@Component
@ProcessingGroup(value = "conventions")
public class Listener {

 private static final Logger LOGGER = LoggerFactory.getLogger(GenericListener.class);

 @EventHandler
 void on(ConventionCreatedEvent event) {
  LOGGER.info("got the event {}", event);
 }

}
1

1 Answers

1
votes

I think it's the name of the Kafka message source within your configuration which is the culprit right now Aymen.

When using Axon's auto configuration and the Axon-Kafka auto configuration without any specifics on which type of Kafka message source you desire, a StreamableKafkaMessageSource will be created. The name of that bean will be the streamableKafkaMessageSource.

In your application.yml you however expect the source for your conventions Tracking Event Processor to be called kafkaMessageSource.

Next to this you can have a look at the example application contained within Axon's Kafka Extension. Maybe that makes things a bit more clear.