1 package de.juplo.kafka;
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 import org.springframework.util.Assert;
10 import java.util.concurrent.Executors;
13 @SpringBootApplication
14 @EnableConfigurationProperties(ApplicationProperties.class)
15 public class Application
18 ApplicationProperties properties;
22 public EndlessConsumer consumer()
24 Assert.hasText(properties.getBootstrapServer(), "consumer.bootstrap-server must be set");
25 Assert.hasText(properties.getGroupId(), "consumer.group-id must be set");
26 Assert.hasText(properties.getClientId(), "consumer.client-id must be set");
27 Assert.hasText(properties.getTopic(), "consumer.topic must be set");
29 EndlessConsumer consumer =
31 Executors.newFixedThreadPool(1),
32 properties.getBootstrapServer(),
33 properties.getGroupId(),
34 properties.getClientId(),
35 properties.getTopic(),
36 properties.getAutoOffsetReset());
43 public static void main(String[] args)
45 SpringApplication.run(Application.class, args);