Removing bad code
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Thu, 26 Jan 2017 13:11:50 +0000 (14:11 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Thu, 26 Jan 2017 13:11:50 +0000 (14:11 +0100)
SpringJava/Kafka/SpringKafka/spring-kafka-consumer-example/src/main/java/de/example/spring/kafka/Application.java

index c0222a0..8c533c5 100644 (file)
@@ -3,35 +3,20 @@ package de.example.spring.kafka;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
-import org.springframework.kafka.support.KafkaNull;
-import org.springframework.messaging.Message;
-import org.springframework.messaging.MessageChannel;
-import org.springframework.messaging.PollableChannel;
-import org.springframework.messaging.support.GenericMessage;
 
 @SpringBootApplication
 public class Application {
 
-  public static void main(String[] args) throws Exception {
-    ConfigurableApplicationContext context
-        = new SpringApplicationBuilder(Application.class)
-        .web(false)
-        .run(args);
-    MessageChannel toKafka = context.getBean("toKafka", MessageChannel.class);
-    for (int i = 0; i < 10; i++) {
-      toKafka.send(new GenericMessage<>("foo" + i));
-    }
-    toKafka.send(new GenericMessage<>(KafkaNull.INSTANCE));
-    PollableChannel fromKafka = context.getBean("received", PollableChannel.class);
-    Message<?> received = fromKafka.receive(10000);
-    while (received != null) {
-      System.out.println(received);
-      received = fromKafka.receive(10000);
-    }
-    context.close();
-    System.exit(0);
+  public static void main(String[] args) {
+    SpringApplication.run(Application.class);
   }
+
+  @Bean
+  CommandLineRunner lookup(Receiver receiver) {
+    return args -> {
+
+    };
+  }
+
 }