Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8F0581823A for ; Thu, 27 Aug 2015 15:56:46 +0000 (UTC) Received: (qmail 57424 invoked by uid 500); 27 Aug 2015 15:56:46 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 57277 invoked by uid 500); 27 Aug 2015 15:56:46 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 57179 invoked by uid 99); 27 Aug 2015 15:56:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Aug 2015 15:56:46 +0000 Date: Thu, 27 Aug 2015 15:56:46 +0000 (UTC) From: "Boyang Jerry Peng (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-2585) KafkaSource not working MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-2585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14716916#comment-14716916 ] Boyang Jerry Peng commented on FLINK-2585: ------------------------------------------ I'm looking at the .out files, but I have looked at the .log files and that don't have any of the data I am sending either just log messages. > KafkaSource not working > ----------------------- > > Key: FLINK-2585 > URL: https://issues.apache.org/jira/browse/FLINK-2585 > Project: Flink > Issue Type: Bug > Reporter: Boyang Jerry Peng > > I tried running the KafkaConsumerExample with that is subscribing to a console producer of kafka but the KafkaConsumerExample topology was not receiving any data from Kafka. Then I wrote my own topology that uses Kafka as a source but it didn't work as well. The topologies would run but receive not data. If I run a console consumer that subscibes to the topic of the console producer, the console consumer receives data from the producer which indicates the producer is working correctly. Can someone help me with this problem? > Kafka console producer I am running: > bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test > The flink code I am running: > {code} > public class KafkaDataProcessor { > private static int port; > private static String hostname; > private static String topic; > private static final Logger LOG = LoggerFactory.getLogger(KafkaDataProcessor.class); > public static void main(String[] args) { > if (!parseParameters(args)) { > return; > } > System.out.println("Start listening for data on: " + hostname + ":" + port + " for topic: " + topic); > StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); > DataStream> dataStream = env > .addSource(new KafkaSource(hostname + ":" + port, topic, "test-consumer-group", new SimpleStringSchema(), 200L), "Kafka source").setParallelism(2) > .flatMap(new Splitter()).setParallelism(2) > .groupBy(0) > .sum(1).setParallelism(2); > dataStream.print().setParallelism(2); > try { > env.execute("kafka processor"); > } catch (Exception e) { > e.printStackTrace(); > } > } > public static class Splitter implements FlatMapFunction> { > @Override > public void flatMap(String sentence, Collector> out) throws Exception { > for (String word : sentence.split(" ")) { > System.out.println("word: " + word); > LOG.info("word: {}", word); > out.collect(new Tuple2(word, 1)); > } > } > } > private static boolean parseParameters(String[] args) { > if (args.length > 0) { > if (args.length == 3) { > hostname = args[0]; > port = Integer.parseInt(args[1]); > topic = args[2]; > } else { > System.err.println("Usage: KafkaDataProcessor "); > return false; > } > } else { > System.out.println("Executing KafkaDataProcessor example with built-in default data."); > System.out.println(" Provide Hostname and Port to read input data from."); > System.out.println(" Usage: KafkaDataProcessor "); > return false; > } > return true; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)