You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by rmetzger <gi...@git.apache.org> on 2015/04/15 22:22:06 UTC

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

GitHub user rmetzger opened a pull request:

    https://github.com/apache/flink/pull/603

    [FLINK-1753] Extend KafkaITCase, reworked PersistentKafkaSource (initially)

    Added large messages test and reworked PersistentKafkaSource.
    
    A Flink user I'm talking with offline is affected by this issue, that's why I would like to merge this rather soon. (I am aware that one test case is failing, so I'll spend more time on this tomorrow morning)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rmetzger/flink kafka_big_records-rebased

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/603.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #603
    
----
commit e8bb15a686f17710c709662b4eaf475b8e3de528
Author: Robert Metzger <rm...@apache.org>
Date:   2015-04-13T14:23:58Z

    [FLINK-1753] Extend KafkaITCase with large messages test + rework PersistentKafkaSource.

commit c3be60f1db82ecee7b0a9cca0f1f637bfd722739
Author: Robert Metzger <rm...@apache.org>
Date:   2015-04-15T20:20:03Z

    wip

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

Posted by mbalassi <gi...@git.apache.org>.
Github user mbalassi commented on the pull request:

    https://github.com/apache/flink/pull/603#issuecomment-93665013
  
    LGTM besides that one question.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

Posted by rmetzger <gi...@git.apache.org>.
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/603#discussion_r28489103
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-connectors/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaITCase.java ---
    @@ -709,4 +834,72 @@ private static KafkaServer getKafkaServer(int brokerId, File tmpFolder) throws U
     		private static final long serialVersionUID = 1L;
     	}
     
    +/*	@Test
    +	public void testKafkaWithoutFlink() {
    +
    +		// start consumer:
    +		new Thread(new Runnable() {
    +			@Override
    +			public void run() {
    +				LOG.info("Starting consumer");
    +				// consume from "testtopic"
    +
    +				Properties cprops = new Properties();
    +				cprops.put("zookeeper.connect", zookeeperConnectionString);
    +				cprops.put("group.id", "mygroupid");
    +				cprops.put("zookeeper.session.timeout.ms", "400");
    +				cprops.put("zookeeper.sync.time.ms", "200");
    +				cprops.put("auto.commit.interval.ms", "1000");
    +				ConsumerConnector jcc = Consumer.createJavaConsumerConnector(new ConsumerConfig(cprops));
    +				Map<String,Integer> tcm = new HashMap<String, Integer>(1);
    +				tcm.put("testtopic", 1);
    +				Map<String, List<KafkaStream<byte[], byte[]>>> ms = jcc.createMessageStreams(tcm);
    +				LOG.info("message streams "+ms);
    +				Assert.assertEquals(1, ms.size());
    +
    +				List<KafkaStream<byte[], byte[]>> strList = ms.get("testtopic");
    +				Assert.assertEquals(1, strList.size());
    +
    +				KafkaStream<byte[], byte[]> str = strList.get(0);
    +				LOG.info("str = "+str);
    +
    +				ConsumerIterator<byte[], byte[]> it = str.iterator();
    +				while(it.hasNext()) {
    +					MessageAndMetadata<byte[], byte[]> msg = it.next();
    +					LOG.info("msg = "+msg);
    +				}
    +				LOG.info("Finished consumer");
    +			}
    +		}).start();
    +
    +		// start producer:
    +		Properties props = new Properties();
    +		String brks = "";
    +		for(KafkaServer broker : brokers) {
    +			SocketServer srv = broker.socketServer();
    +			String host = "localhost";
    +			if(srv.host() != null) {
    +				host = srv.host();
    +			}
    +			brks += host+":"+broker.socketServer().port()+",";
    +		}
    +		LOG.info("Using broker list "+brks);
    +		props.setProperty("metadata.broker.list", brks);
    +		props.put("serializer.class", StringEncoder.class.getCanonicalName());
    +
    +		ProducerConfig config = new ProducerConfig(props);
    +		Producer p = new Producer<String, String>(config);
    +
    +		for(int i = 0; i < 10; i++) {
    +			p.send(new KeyedMessage<String, String>("testtopic", "What a message"));
    +		}
    +
    +		LOG.info("+++++++++++ FINISHED PRODUCING ++++++++++++++++ ");
    +
    +		try {
    +			Thread.sleep(1000000);
    +		} catch (InterruptedException e) {
    +			e.printStackTrace();
    +		}
    --- End diff --
    
    I was so desperate that I wanted to test the Kafka stuff without any Flink code. But in the end I figured it out.
    
    I can remove the code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/603


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

Posted by mbalassi <gi...@git.apache.org>.
Github user mbalassi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/603#discussion_r28488904
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-connectors/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaITCase.java ---
    @@ -709,4 +834,72 @@ private static KafkaServer getKafkaServer(int brokerId, File tmpFolder) throws U
     		private static final long serialVersionUID = 1L;
     	}
     
    +/*	@Test
    +	public void testKafkaWithoutFlink() {
    +
    +		// start consumer:
    +		new Thread(new Runnable() {
    +			@Override
    +			public void run() {
    +				LOG.info("Starting consumer");
    +				// consume from "testtopic"
    +
    +				Properties cprops = new Properties();
    +				cprops.put("zookeeper.connect", zookeeperConnectionString);
    +				cprops.put("group.id", "mygroupid");
    +				cprops.put("zookeeper.session.timeout.ms", "400");
    +				cprops.put("zookeeper.sync.time.ms", "200");
    +				cprops.put("auto.commit.interval.ms", "1000");
    +				ConsumerConnector jcc = Consumer.createJavaConsumerConnector(new ConsumerConfig(cprops));
    +				Map<String,Integer> tcm = new HashMap<String, Integer>(1);
    +				tcm.put("testtopic", 1);
    +				Map<String, List<KafkaStream<byte[], byte[]>>> ms = jcc.createMessageStreams(tcm);
    +				LOG.info("message streams "+ms);
    +				Assert.assertEquals(1, ms.size());
    +
    +				List<KafkaStream<byte[], byte[]>> strList = ms.get("testtopic");
    +				Assert.assertEquals(1, strList.size());
    +
    +				KafkaStream<byte[], byte[]> str = strList.get(0);
    +				LOG.info("str = "+str);
    +
    +				ConsumerIterator<byte[], byte[]> it = str.iterator();
    +				while(it.hasNext()) {
    +					MessageAndMetadata<byte[], byte[]> msg = it.next();
    +					LOG.info("msg = "+msg);
    +				}
    +				LOG.info("Finished consumer");
    +			}
    +		}).start();
    +
    +		// start producer:
    +		Properties props = new Properties();
    +		String brks = "";
    +		for(KafkaServer broker : brokers) {
    +			SocketServer srv = broker.socketServer();
    +			String host = "localhost";
    +			if(srv.host() != null) {
    +				host = srv.host();
    +			}
    +			brks += host+":"+broker.socketServer().port()+",";
    +		}
    +		LOG.info("Using broker list "+brks);
    +		props.setProperty("metadata.broker.list", brks);
    +		props.put("serializer.class", StringEncoder.class.getCanonicalName());
    +
    +		ProducerConfig config = new ProducerConfig(props);
    +		Producer p = new Producer<String, String>(config);
    +
    +		for(int i = 0; i < 10; i++) {
    +			p.send(new KeyedMessage<String, String>("testtopic", "What a message"));
    +		}
    +
    +		LOG.info("+++++++++++ FINISHED PRODUCING ++++++++++++++++ ");
    +
    +		try {
    +			Thread.sleep(1000000);
    +		} catch (InterruptedException e) {
    +			e.printStackTrace();
    +		}
    --- End diff --
    
    Why do you have this as comment?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-1753] Extend KafkaITCase, reworked Pers...

Posted by rmetzger <gi...@git.apache.org>.
Github user rmetzger commented on the pull request:

    https://github.com/apache/flink/pull/603#issuecomment-93568853
  
    The failed test has been resolved.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---