{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/56409148","id":56409148,"diff_hunk":"@@ -0,0 +1,298 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ *   or more contributor license agreements.  See the NOTICE file\n+ *   distributed with this work for additional information\n+ *   regarding copyright ownership.  The ASF licenses this file\n+ *   to you under the Apache License, Version 2.0 (the\n+ *   \"License\"); you may not use this file except in compliance\n+ *   with the License.  You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ *   Unless required by applicable law or agreed to in writing, software\n+ *   distributed under the License is distributed on an \"AS IS\" BASIS,\n+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ *   See the License for the specific language governing permissions and\n+ *   limitations under the License.\n+ */\n+\n+package org.apache.storm.kafka.spout;\n+\n+import org.apache.kafka.common.serialization.Deserializer;\n+\n+import java.io.Serializable;\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.Map;\n+\n+/**\n+ * KafkaSpoutConfig defines the required configuration to connect a consumer to a consumer group, as well as the subscribing topics\n+ */\n+public class KafkaSpoutConfig<K, V> implements Serializable {\n+    public static final long DEFAULT_POLL_TIMEOUT_MS = 2_000;            // 2s\n+    public static final long DEFAULT_OFFSET_COMMIT_PERIOD_MS = 15_000;   // 15s\n+    public static final int DEFAULT_MAX_RETRIES = Integer.MAX_VALUE;     // Retry forever\n+    public static final int DEFAULT_MAX_UNCOMMITTED_OFFSETS = 10_000;    // 10,000 records\n+\n+    // Kafka property names\n+    public interface Consumer {\n+        String GROUP_ID = \"group.id\";\n+        String BOOTSTRAP_SERVERS = \"bootstrap.servers\";\n+        String ENABLE_AUTO_COMMIT = \"enable.auto.commit\";\n+        String AUTO_COMMIT_INTERVAL_MS = \"auto.commit.interval.ms\";\n+        String KEY_DESERIALIZER = \"key.deserializer\";\n+        String VALUE_DESERIALIZER = \"value.deserializer\";\n+    }\n+\n+    /**\n+     * The offset used by the Kafka spout in the first poll to Kafka broker. The choice of this parameter will\n+     * affect the number of consumer records returned in the first poll. By default this parameter is set to UNCOMMITTED_EARLIEST. <br/><br/>\n+     * The allowed values are EARLIEST, LATEST, UNCOMMITTED_EARLIEST, UNCOMMITTED_LATEST. <br/>\n+     * <ul>\n+     * <li>EARLIEST means that the kafka spout polls records starting in the first offset of the partition, regardless of previous commits</li>\n+     * <li>LATEST means that the kafka spout polls records with offsets greater than the last offset in the partition, regardless of previous commits</li>\n+     * <li>UNCOMMITTED_EARLIEST means that the kafka spout polls records from the last committed offset, if any.\n+     * If no offset has been committed, it behaves as EARLIEST.</li>\n+     * <li>UNCOMMITTED_LATEST means that the kafka spout polls records from the last committed offset, if any.\n+     * If no offset has been committed, it behaves as LATEST.</li>\n+     * </ul>\n+     * */\n+    public enum FirstPollOffsetStrategy {\n+        EARLIEST,\n+        LATEST,\n+        UNCOMMITTED_EARLIEST,\n+        UNCOMMITTED_LATEST }\n+\n+    /**\n+     * Defines when to poll the next batch of records from Kafka. The choice of this parameter will affect throughput and the memory\n+     * footprint of the Kafka spout. The allowed values are STREAM and BATCH. STREAM will likely have higher throughput and use more memory\n+     * (it stores in memory the entire KafkaRecord,including data). BATCH will likely have less throughput but also use less memory.\n+     * The BATCH behavior is similar to the behavior of the previous Kafka Spout. De default value is STREAM.\n+     * <ul>\n+     *     <li>STREAM Every periodic call to nextTuple polls a new batch of records from Kafka as long as the maxUncommittedOffsets\n+     *     threshold has not yet been reached. When the threshold his reached, no more records are polled until enough offsets have been\n+     *     committed, such that the number of pending offsets is less than maxUncommittedOffsets. See {@link Builder#setMaxUncommittedOffsets(int)}\n+     *     </li>\n+     *     <li>BATCH Only polls a new batch of records from kafka once all the records that came in the previous poll have been acked.</li>\n+     * </ul>\n+     */\n+    public enum PollStrategy {\n+        STREAM,\n+        BATCH","path":"external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpoutConfig.java","position":81,"original_position":81,"commit_id":"afc3bdebd70faac9da6af907c18665f47604a012","original_commit_id":"afc3bdebd70faac9da6af907c18665f47604a012","user":{"login":"harshach","id":38649,"avatar_url":"https://avatars.githubusercontent.com/u/38649?v=3","gravatar_id":"","url":"https://api.github.com/users/harshach","html_url":"https://github.com/harshach","followers_url":"https://api.github.com/users/harshach/followers","following_url":"https://api.github.com/users/harshach/following{/other_user}","gists_url":"https://api.github.com/users/harshach/gists{/gist_id}","starred_url":"https://api.github.com/users/harshach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshach/subscriptions","organizations_url":"https://api.github.com/users/harshach/orgs","repos_url":"https://api.github.com/users/harshach/repos","events_url":"https://api.github.com/users/harshach/events{/privacy}","received_events_url":"https://api.github.com/users/harshach/received_events","type":"User","site_admin":false},"body":"@revans2 makes sense. Yes one of the things considered was to make network call vs  in-memory replay. We all agree on failures not-norm and I am +1 on removing the in-memory replay and instead make a call to broker to replay the message. \r\nBATCH can go away as well once we fix the in-memory replay. BATCH is there to mimic the old spout behavior.","created_at":"2016-03-16T20:31:57Z","updated_at":"2016-03-16T20:31:57Z","html_url":"https://github.com/apache/storm/pull/1131#discussion_r56409148","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/1131","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/56409148"},"html":{"href":"https://github.com/apache/storm/pull/1131#discussion_r56409148"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/1131"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/1131","id":60106809,"html_url":"https://github.com/apache/storm/pull/1131","diff_url":"https://github.com/apache/storm/pull/1131.diff","patch_url":"https://github.com/apache/storm/pull/1131.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/1131","number":1131,"state":"open","locked":false,"title":"STORM-822: Kafka Spout New Consumer API","user":{"login":"hmcl","id":10284328,"avatar_url":"https://avatars.githubusercontent.com/u/10284328?v=3","gravatar_id":"","url":"https://api.github.com/users/hmcl","html_url":"https://github.com/hmcl","followers_url":"https://api.github.com/users/hmcl/followers","following_url":"https://api.github.com/users/hmcl/following{/other_user}","gists_url":"https://api.github.com/users/hmcl/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcl/subscriptions","organizations_url":"https://api.github.com/users/hmcl/orgs","repos_url":"https://api.github.com/users/hmcl/repos","events_url":"https://api.github.com/users/hmcl/events{/privacy}","received_events_url":"https://api.github.com/users/hmcl/received_events","type":"User","site_admin":false},"body":"This patch is still under development and was uploaded at this moment for early testing. Please read README.\r\n\r\nThere may be a bug in the offsets management, because of diff o 1. I am looking into it. \r\nCurrently polling from an arbitrary offset is possible but it will come in the next patch, today or tomorrow\r\nI refactored the code a bit and left, maybe, some unnecessary locking. I am also looking into it.\r\n\r\n@connieyang @jianbzhou @tgravescs please let me know of any other requirements you may have and I will address them soon.\r\n\r\nThanks","created_at":"2016-02-21T22:18:37Z","updated_at":"2016-03-16T20:31:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"611887f25c35ee295522a6be397c67b672c4edcd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/1131/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/1131/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/1131/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/afc3bdebd70faac9da6af907c18665f47604a012","head":{"label":"hmcl:STORM-822","ref":"STORM-822","sha":"afc3bdebd70faac9da6af907c18665f47604a012","user":{"login":"hmcl","id":10284328,"avatar_url":"https://avatars.githubusercontent.com/u/10284328?v=3","gravatar_id":"","url":"https://api.github.com/users/hmcl","html_url":"https://github.com/hmcl","followers_url":"https://api.github.com/users/hmcl/followers","following_url":"https://api.github.com/users/hmcl/following{/other_user}","gists_url":"https://api.github.com/users/hmcl/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcl/subscriptions","organizations_url":"https://api.github.com/users/hmcl/orgs","repos_url":"https://api.github.com/users/hmcl/repos","events_url":"https://api.github.com/users/hmcl/events{/privacy}","received_events_url":"https://api.github.com/users/hmcl/received_events","type":"User","site_admin":false},"repo":{"id":37676775,"name":"storm-apache","full_name":"hmcl/storm-apache","owner":{"login":"hmcl","id":10284328,"avatar_url":"https://avatars.githubusercontent.com/u/10284328?v=3","gravatar_id":"","url":"https://api.github.com/users/hmcl","html_url":"https://github.com/hmcl","followers_url":"https://api.github.com/users/hmcl/followers","following_url":"https://api.github.com/users/hmcl/following{/other_user}","gists_url":"https://api.github.com/users/hmcl/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcl/subscriptions","organizations_url":"https://api.github.com/users/hmcl/orgs","repos_url":"https://api.github.com/users/hmcl/repos","events_url":"https://api.github.com/users/hmcl/events{/privacy}","received_events_url":"https://api.github.com/users/hmcl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hmcl/storm-apache","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/hmcl/storm-apache","forks_url":"https://api.github.com/repos/hmcl/storm-apache/forks","keys_url":"https://api.github.com/repos/hmcl/storm-apache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcl/storm-apache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcl/storm-apache/teams","hooks_url":"https://api.github.com/repos/hmcl/storm-apache/hooks","issue_events_url":"https://api.github.com/repos/hmcl/storm-apache/issues/events{/number}","events_url":"https://api.github.com/repos/hmcl/storm-apache/events","assignees_url":"https://api.github.com/repos/hmcl/storm-apache/assignees{/user}","branches_url":"https://api.github.com/repos/hmcl/storm-apache/branches{/branch}","tags_url":"https://api.github.com/repos/hmcl/storm-apache/tags","blobs_url":"https://api.github.com/repos/hmcl/storm-apache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcl/storm-apache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcl/storm-apache/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcl/storm-apache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcl/storm-apache/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcl/storm-apache/languages","stargazers_url":"https://api.github.com/repos/hmcl/storm-apache/stargazers","contributors_url":"https://api.github.com/repos/hmcl/storm-apache/contributors","subscribers_url":"https://api.github.com/repos/hmcl/storm-apache/subscribers","subscription_url":"https://api.github.com/repos/hmcl/storm-apache/subscription","commits_url":"https://api.github.com/repos/hmcl/storm-apache/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcl/storm-apache/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcl/storm-apache/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcl/storm-apache/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcl/storm-apache/contents/{+path}","compare_url":"https://api.github.com/repos/hmcl/storm-apache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcl/storm-apache/merges","archive_url":"https://api.github.com/repos/hmcl/storm-apache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcl/storm-apache/downloads","issues_url":"https://api.github.com/repos/hmcl/storm-apache/issues{/number}","pulls_url":"https://api.github.com/repos/hmcl/storm-apache/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcl/storm-apache/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcl/storm-apache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcl/storm-apache/labels{/name}","releases_url":"https://api.github.com/repos/hmcl/storm-apache/releases{/id}","deployments_url":"https://api.github.com/repos/hmcl/storm-apache/deployments","created_at":"2015-06-18T18:19:49Z","updated_at":"2016-02-12T22:37:39Z","pushed_at":"2016-03-15T06:31:26Z","git_url":"git://github.com/hmcl/storm-apache.git","ssh_url":"git@github.com:hmcl/storm-apache.git","clone_url":"https://github.com/hmcl/storm-apache.git","svn_url":"https://github.com/hmcl/storm-apache","homepage":null,"size":28615,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"1a0ed9a3764d35f4a756e597e330182606d64163","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/storm/deployments","created_at":"2013-11-05T08:00:14Z","updated_at":"2016-03-16T15:40:13Z","pushed_at":"2016-03-16T18:23:35Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":162347,"stargazers_count":2949,"watchers_count":2949,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2218,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":91,"forks":2218,"open_issues":91,"watchers":2949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/1131"},"html":{"href":"https://github.com/apache/storm/pull/1131"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/1131"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/1131/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/1131/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/1131/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/afc3bdebd70faac9da6af907c18665f47604a012"}}}}