WIP
[demos/kafka/seek] / src / main / java / de / juplo / kafka / seek / Application.java
1 package de.juplo.kafka.seek;
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 import org.springframework.util.Assert;
9
10 import java.util.concurrent.Executors;
11
12
13 @SpringBootApplication
14 @EnableConfigurationProperties(ApplicationProperties.class)
15 public class Application
16 {
17
18   @Autowired
19   ApplicationProperties properties;
20
21
22   @Bean
23   public Consumer consumer()
24   {
25     Assert.hasText(properties.getBootstrapServer(), "seek.bootstrap-server must be set");
26     Assert.hasText(properties.getGroupId(), "seek.group-id must be set");
27     Assert.hasText(properties.getClientId(), "seek.client-id must be set");
28     Assert.hasText(properties.getTopic(), "seek.topic must be set");
29
30     return
31         new Consumer(
32             Executors.newFixedThreadPool(1),
33             properties.getBootstrapServer(),
34             properties.getGroupId(),
35             properties.getClientId(),
36             properties.getTopic());
37   }
38
39   public static void main(String[] args)
40   {
41     SpringApplication.run(Application.class, args);
42   }
43 }