Skip to content
This repository has been 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

Open
ghilainm opened this issue Aug 13, 2018 · 4 comments

Comments

@ghilainm
Copy link

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?

@nklmish
Copy link

nklmish commented Sep 8, 2018

@ghilainm Thanks for creating the issue, the autoconfiguration should be fixed via
PR-765, for more details, please refer to this

@marinkobabic
Copy link

In the version 3.4 it's still not working properly. Please do the suggested changes here AxonFramework/AxonFramework#710

@smcvb
Copy link
Member

smcvb commented Nov 1, 2018

@nklmish would you be able to verify @marinkobabic his statement?

@marinkobabic
Copy link

marinkobabic commented Nov 1, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants