From a72cdce2a6bec10caee3a07ebcd8bd24ca1a50a6 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Thu, 26 Jan 2017 14:11:50 +0100 Subject: [PATCH] Removing bad code --- .../java/de/example/spring/kafka/Application.java | 35 +++++++--------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/SpringJava/Kafka/SpringKafka/spring-kafka-consumer-example/src/main/java/de/example/spring/kafka/Application.java b/SpringJava/Kafka/SpringKafka/spring-kafka-consumer-example/src/main/java/de/example/spring/kafka/Application.java index c0222a0..8c533c5 100644 --- a/SpringJava/Kafka/SpringKafka/spring-kafka-consumer-example/src/main/java/de/example/spring/kafka/Application.java +++ b/SpringJava/Kafka/SpringKafka/spring-kafka-consumer-example/src/main/java/de/example/spring/kafka/Application.java @@ -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 -> { + + }; + } + } -- 2.1.4