Merge der Upgrades für Confluent/Spring-Boot (Branch 'first-contact')
[demos/kafka/training] / src / main / java / de / juplo / kafka / Application.java
1 package de.juplo.kafka;
2
3 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.boot.SpringApplication;
5 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 import org.springframework.boot.context.properties.EnableConfigurationProperties;
7 import org.springframework.context.annotation.Bean;
8
9 import java.util.concurrent.Executors;
10
11
12 @SpringBootApplication
13 @EnableConfigurationProperties(ApplicationProperties.class)
14 public class Application
15 {
16   @Autowired
17   ApplicationProperties properties;
18
19
20   @Bean
21   public EndlessConsumer consumer()
22   {
23     EndlessConsumer consumer =
24         new EndlessConsumer(
25             Executors.newFixedThreadPool(1),
26             properties.getBootstrapServer(),
27             properties.getGroupId(),
28             properties.getClientId(),
29             properties.getTopic(),
30             properties.getAutoOffsetReset());
31
32     consumer.start();
33
34     return consumer;
35   }
36
37   public static void main(String[] args)
38   {
39     SpringApplication.run(Application.class, args);
40   }
41 }