package de.juplo.kafka;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-
-import java.util.concurrent.Executors;
@SpringBootApplication
-@EnableConfigurationProperties(ApplicationProperties.class)
public class Application
{
- @Autowired
- ApplicationProperties properties;
-
-
- @Bean
- public EndlessConsumer consumer()
- {
- EndlessConsumer consumer =
- new EndlessConsumer(
- Executors.newFixedThreadPool(1),
- properties.getBootstrapServer(),
- properties.getGroupId(),
- properties.getClientId(),
- properties.getTopic(),
- properties.getAutoOffsetReset());
-
- consumer.start();
-
- return consumer;
- }
-
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);