Skip to content
This repository was archived by the owner on Dec 7, 2018. It is now read-only.

Kafka Consumer > KafkaAutoConfiguration seems not to work [axon 3.3.3 + spring boot 2.0.4.RELEASE] #82

@ghilainm

Description

@ghilainm

I have defined no additional configuration and the application doesn't start by just defining the consumer-group-id as defined the Axon documentation.

Dependencies:

    implementation('org.axonframework:axon-spring-boot-starter:3.3.3')
    implementation('org.apache.kafka:kafka-clients:2.0.0')
    implementation('org.axonframework:axon-kafka:3.3.3')
    + spring-boot 2.0.4.RELEASE

Here is the configuration i have defined in my application.yml

axon:
  kafka:
    default-topic: "my-topic"
    bootstrap-servers: "bootstrap.kafka.svc.cluster.local:9092"
    consumer:
      group-id: "query-consumer"
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.ByteArrayDeserializer

Here are the corresponding starting logs:


***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method kafkaMessageSource in org.axonframework.boot.autoconfig.KafkaAutoConfiguration required a bean of type 'org.axonframework.kafka.eventhandling.consumer.Fetcher' that could not be found.
	- Bean method 'kafkaFetcher' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnBean (types: org.axonframework.kafka.eventhandling.consumer.ConsumerFactory,org.axonframework.kafka.eventhandling.KafkaMessageConverter; SearchStrategy: all) did not find any beans of type org.axonframework.kafka.eventhandling.KafkaMessageConverter


Action:

Consider revisiting the entries above or defining a bean of type 'org.axonframework.kafka.eventhandling.consumer.Fetcher' in your configuration.

2018-08-13 18:42:36,923 ERROR :  gid: trace= span= [main] o.s.b.d.LoggingFailureAnalysisReporter 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method kafkaMessageSource in org.axonframework.boot.autoconfig.KafkaAutoConfiguration required a bean of type 'org.axonframework.kafka.eventhandling.consumer.Fetcher' that could not be found.
	- Bean method 'kafkaFetcher' in 'KafkaAutoConfiguration' not loaded because @ConditionalOnBean (types: org.axonframework.kafka.eventhandling.consumer.ConsumerFactory,org.axonframework.kafka.eventhandling.KafkaMessageConverter; SearchStrategy: all) did not find any beans of type org.axonframework.kafka.eventhandling.KafkaMessageConverter

I could make the application start by redefining this in a class annotated with @configuration:

@ConditionalOnMissingBean
    @Bean
    public KafkaMessageConverter<String, byte[]> kafkaMessageConverter(
            @Qualifier("eventSerializer") Serializer eventSerializer) {
        return new DefaultKafkaMessageConverter(eventSerializer);
    }

But still nothing is consumed from the Kafka topic (no tracking event processor is started).

I then tried to define to add this in addition to try to register manually an event processor for my KafkaMessageSource but still without any success.

    @Autowired
    public void trackingEventProcessor(
            @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") EventProcessingConfiguration eventProcessingConfiguration,
            KafkaMessageSource kafkaMessageSource) {
        eventProcessingConfiguration.registerTrackingEventProcessorUsingSource("kafka-tracking-event-processor", configuration -> kafkaMessageSource);
    }

    @Bean
    public EventStorageEngine eventStorageEngine(){
        return new InMemoryEventStorageEngine();
    }

    @Bean
    public TokenStore tokenSTore(){
        return new InMemoryTokenStore();
    }

Any clue on how to configure this properly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions