{"action":"created","comment":{"url":"https://api.github.com/repos/confluentinc/kafka/pulls/comments/36591516","id":36591516,"diff_hunk":"@@ -0,0 +1,86 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * 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.kafka.clients.processor;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+public abstract class KafkaProcessor<K1, V1, K2, V2> implements Processor<K1, V1>, Receiver<K1, V1>, Punctuator {\n+\n+    private final List<KafkaProcessor<K2, V2, ?, ?>> children;\n+    private final List<KafkaProcessor<?, ?, K1, V1>> parents;\n+\n+    private final String name;\n+\n+    public boolean initialized;\n+    public boolean closed;\n+\n+    public KafkaProcessor(String name) {\n+        this.name = name;\n+        this.children  = new ArrayList<>();\n+        this.parents = new ArrayList<>();\n+\n+        this.initialized = false;\n+        this.closed = false;\n+    }\n+\n+    public String name() {\n+        return name;\n+    }\n+\n+    public List<KafkaProcessor<K2, V2, ?, ?>> children() {\n+        return children;\n+    }\n+\n+    public List<KafkaProcessor<?, ?, K1, V1>> parents() {\n+        return parents;\n+    }\n+\n+    public final void chain(KafkaProcessor<K2, V2, ?, ?> child) {\n+        child.parents.add(this);\n+        children.add(child);\n+    }\n+\n+    public final void forward(K2 key, V2 value) {","path":"stream/src/main/java/org/apache/kafka/clients/processor/KafkaProcessor.java","position":59,"original_position":59,"commit_id":"1645d1ca27e66dc1f4ea9377dc6ed5df1e1ee43c","original_commit_id":"1645d1ca27e66dc1f4ea9377dc6ed5df1e1ee43c","user":{"login":"jkreps","id":90438,"avatar_url":"https://avatars.githubusercontent.com/u/90438?v=3","gravatar_id":"","url":"https://api.github.com/users/jkreps","html_url":"https://github.com/jkreps","followers_url":"https://api.github.com/users/jkreps/followers","following_url":"https://api.github.com/users/jkreps/following{/other_user}","gists_url":"https://api.github.com/users/jkreps/gists{/gist_id}","starred_url":"https://api.github.com/users/jkreps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkreps/subscriptions","organizations_url":"https://api.github.com/users/jkreps/orgs","repos_url":"https://api.github.com/users/jkreps/repos","events_url":"https://api.github.com/users/jkreps/events{/privacy}","received_events_url":"https://api.github.com/users/jkreps/received_events","type":"User","site_admin":false},"body":"I think forward should be in ProcessorContext.","created_at":"2015-08-09T18:09:16Z","updated_at":"2015-08-09T18:09:16Z","html_url":"https://github.com/confluentinc/kafka/pull/5#discussion_r36591516","pull_request_url":"https://api.github.com/repos/confluentinc/kafka/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/comments/36591516"},"html":{"href":"https://github.com/confluentinc/kafka/pull/5#discussion_r36591516"},"pull_request":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/confluentinc/kafka/pulls/5","id":41866795,"html_url":"https://github.com/confluentinc/kafka/pull/5","diff_url":"https://github.com/confluentinc/kafka/pull/5.diff","patch_url":"https://github.com/confluentinc/kafka/pull/5.patch","issue_url":"https://api.github.com/repos/confluentinc/kafka/issues/5","number":5,"state":"open","locked":false,"title":"Alternative API with KStream on top of Processor","user":{"login":"guozhangwang","id":10729597,"avatar_url":"https://avatars.githubusercontent.com/u/10729597?v=3","gravatar_id":"","url":"https://api.github.com/users/guozhangwang","html_url":"https://github.com/guozhangwang","followers_url":"https://api.github.com/users/guozhangwang/followers","following_url":"https://api.github.com/users/guozhangwang/following{/other_user}","gists_url":"https://api.github.com/users/guozhangwang/gists{/gist_id}","starred_url":"https://api.github.com/users/guozhangwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guozhangwang/subscriptions","organizations_url":"https://api.github.com/users/guozhangwang/orgs","repos_url":"https://api.github.com/users/guozhangwang/repos","events_url":"https://api.github.com/users/guozhangwang/events{/privacy}","received_events_url":"https://api.github.com/users/guozhangwang/received_events","type":"User","site_admin":false},"body":"@jkreps @nehanarkhede @ymatsuda \r\n\r\nThis is a second attempt for KStream-on-top-of-Processor: I maintained generics on KafkaProcessor and make addProcessor accepting the parent object directly.","created_at":"2015-08-07T07:39:36Z","updated_at":"2015-08-09T18:09:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"987b7446bd51d8547dbc5e49430bfb06dd2f6508","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/confluentinc/kafka/pulls/5/commits","review_comments_url":"https://api.github.com/repos/confluentinc/kafka/pulls/5/comments","review_comment_url":"https://api.github.com/repos/confluentinc/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/confluentinc/kafka/issues/5/comments","statuses_url":"https://api.github.com/repos/confluentinc/kafka/statuses/1645d1ca27e66dc1f4ea9377dc6ed5df1e1ee43c","head":{"label":"guozhangwang:S-Processor","ref":"S-Processor","sha":"1645d1ca27e66dc1f4ea9377dc6ed5df1e1ee43c","user":{"login":"guozhangwang","id":10729597,"avatar_url":"https://avatars.githubusercontent.com/u/10729597?v=3","gravatar_id":"","url":"https://api.github.com/users/guozhangwang","html_url":"https://github.com/guozhangwang","followers_url":"https://api.github.com/users/guozhangwang/followers","following_url":"https://api.github.com/users/guozhangwang/following{/other_user}","gists_url":"https://api.github.com/users/guozhangwang/gists{/gist_id}","starred_url":"https://api.github.com/users/guozhangwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guozhangwang/subscriptions","organizations_url":"https://api.github.com/users/guozhangwang/orgs","repos_url":"https://api.github.com/users/guozhangwang/repos","events_url":"https://api.github.com/users/guozhangwang/events{/privacy}","received_events_url":"https://api.github.com/users/guozhangwang/received_events","type":"User","site_admin":false},"repo":{"id":39164613,"name":"kafka","full_name":"guozhangwang/kafka","owner":{"login":"guozhangwang","id":10729597,"avatar_url":"https://avatars.githubusercontent.com/u/10729597?v=3","gravatar_id":"","url":"https://api.github.com/users/guozhangwang","html_url":"https://github.com/guozhangwang","followers_url":"https://api.github.com/users/guozhangwang/followers","following_url":"https://api.github.com/users/guozhangwang/following{/other_user}","gists_url":"https://api.github.com/users/guozhangwang/gists{/gist_id}","starred_url":"https://api.github.com/users/guozhangwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guozhangwang/subscriptions","organizations_url":"https://api.github.com/users/guozhangwang/orgs","repos_url":"https://api.github.com/users/guozhangwang/repos","events_url":"https://api.github.com/users/guozhangwang/events{/privacy}","received_events_url":"https://api.github.com/users/guozhangwang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guozhangwang/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/guozhangwang/kafka","forks_url":"https://api.github.com/repos/guozhangwang/kafka/forks","keys_url":"https://api.github.com/repos/guozhangwang/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guozhangwang/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guozhangwang/kafka/teams","hooks_url":"https://api.github.com/repos/guozhangwang/kafka/hooks","issue_events_url":"https://api.github.com/repos/guozhangwang/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/guozhangwang/kafka/events","assignees_url":"https://api.github.com/repos/guozhangwang/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/guozhangwang/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/guozhangwang/kafka/tags","blobs_url":"https://api.github.com/repos/guozhangwang/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guozhangwang/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guozhangwang/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/guozhangwang/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guozhangwang/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/guozhangwang/kafka/languages","stargazers_url":"https://api.github.com/repos/guozhangwang/kafka/stargazers","contributors_url":"https://api.github.com/repos/guozhangwang/kafka/contributors","subscribers_url":"https://api.github.com/repos/guozhangwang/kafka/subscribers","subscription_url":"https://api.github.com/repos/guozhangwang/kafka/subscription","commits_url":"https://api.github.com/repos/guozhangwang/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/guozhangwang/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/guozhangwang/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/guozhangwang/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/guozhangwang/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/guozhangwang/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guozhangwang/kafka/merges","archive_url":"https://api.github.com/repos/guozhangwang/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guozhangwang/kafka/downloads","issues_url":"https://api.github.com/repos/guozhangwang/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/guozhangwang/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/guozhangwang/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/guozhangwang/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guozhangwang/kafka/labels{/name}","releases_url":"https://api.github.com/repos/guozhangwang/kafka/releases{/id}","created_at":"2015-07-15T22:40:38Z","updated_at":"2015-07-15T22:40:41Z","pushed_at":"2015-08-09T04:18:53Z","git_url":"git://github.com/guozhangwang/kafka.git","ssh_url":"git@github.com:guozhangwang/kafka.git","clone_url":"https://github.com/guozhangwang/kafka.git","svn_url":"https://github.com/guozhangwang/kafka","homepage":null,"size":21589,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"confluentinc:streaming","ref":"streaming","sha":"9a01615de8273a7201ac4cb0fdf03b9217935e95","user":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars.githubusercontent.com/u/9439498?v=3","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"repo":{"id":37555321,"name":"kafka","full_name":"confluentinc/kafka","owner":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars.githubusercontent.com/u/9439498?v=3","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/confluentinc/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/confluentinc/kafka","forks_url":"https://api.github.com/repos/confluentinc/kafka/forks","keys_url":"https://api.github.com/repos/confluentinc/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/confluentinc/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/confluentinc/kafka/teams","hooks_url":"https://api.github.com/repos/confluentinc/kafka/hooks","issue_events_url":"https://api.github.com/repos/confluentinc/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/confluentinc/kafka/events","assignees_url":"https://api.github.com/repos/confluentinc/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/confluentinc/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/confluentinc/kafka/tags","blobs_url":"https://api.github.com/repos/confluentinc/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/confluentinc/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/confluentinc/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/confluentinc/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/confluentinc/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/confluentinc/kafka/languages","stargazers_url":"https://api.github.com/repos/confluentinc/kafka/stargazers","contributors_url":"https://api.github.com/repos/confluentinc/kafka/contributors","subscribers_url":"https://api.github.com/repos/confluentinc/kafka/subscribers","subscription_url":"https://api.github.com/repos/confluentinc/kafka/subscription","commits_url":"https://api.github.com/repos/confluentinc/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/confluentinc/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/confluentinc/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/confluentinc/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/confluentinc/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/confluentinc/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/confluentinc/kafka/merges","archive_url":"https://api.github.com/repos/confluentinc/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/confluentinc/kafka/downloads","issues_url":"https://api.github.com/repos/confluentinc/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/confluentinc/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/confluentinc/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/confluentinc/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/confluentinc/kafka/labels{/name}","releases_url":"https://api.github.com/repos/confluentinc/kafka/releases{/id}","created_at":"2015-06-16T20:48:28Z","updated_at":"2015-08-07T12:33:19Z","pushed_at":"2015-08-09T04:18:54Z","git_url":"git://github.com/confluentinc/kafka.git","ssh_url":"git@github.com:confluentinc/kafka.git","clone_url":"https://github.com/confluentinc/kafka.git","svn_url":"https://github.com/confluentinc/kafka","homepage":null,"size":21977,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":3,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/5"},"html":{"href":"https://github.com/confluentinc/kafka/pull/5"},"issue":{"href":"https://api.github.com/repos/confluentinc/kafka/issues/5"},"comments":{"href":"https://api.github.com/repos/confluentinc/kafka/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/confluentinc/kafka/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/confluentinc/kafka/statuses/1645d1ca27e66dc1f4ea9377dc6ed5df1e1ee43c"}}}}