{"action":"created","comment":{"url":"https://api.github.com/repos/akka/reactive-kafka/pulls/comments/56640133","id":56640133,"diff_hunk":"@@ -0,0 +1,51 @@\n+/*\n+ * Copyright (C) 2014 - 2016 Softwaremill <http://softwaremill.com>\n+ * Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>\n+ */\n+package com.softwaremill.react.kafka_api_opt3\n+\n+import scala.concurrent.Future\n+\n+import akka.Done\n+import com.softwaremill.react.kafka_api_producer.Producer\n+import org.apache.kafka.clients.consumer.KafkaConsumer\n+import org.apache.kafka.clients.producer.KafkaProducer\n+import org.apache.kafka.clients.producer.ProducerRecord\n+\n+trait Example {\n+  implicit val ec = scala.concurrent.ExecutionContext.Implicits.global\n+\n+  def consumerProvider: () => KafkaConsumer[Array[Byte], String] = ???\n+\n+  def producerProvider: () => KafkaProducer[Array[Byte], String] = ???\n+\n+  class DB {\n+    def save(offset: Long, data: String): Future[Done] = ???\n+  }\n+}\n+\n+// Consume messages and store a representation, including offset, in DB\n+object Example3 extends Example {\n+  val db = new DB\n+\n+  Consumer.source(consumerProvider)","path":"core/src/main/scala/com/softwaremill/react/kafka_api_opt3/Example.scala","position":31,"original_position":31,"commit_id":"e7665c1e513507cf4282fbd86ac951cc8a28ed64","original_commit_id":"e7665c1e513507cf4282fbd86ac951cc8a28ed64","user":{"login":"drewhk","id":932285,"avatar_url":"https://avatars.githubusercontent.com/u/932285?v=3","gravatar_id":"","url":"https://api.github.com/users/drewhk","html_url":"https://github.com/drewhk","followers_url":"https://api.github.com/users/drewhk/followers","following_url":"https://api.github.com/users/drewhk/following{/other_user}","gists_url":"https://api.github.com/users/drewhk/gists{/gist_id}","starred_url":"https://api.github.com/users/drewhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewhk/subscriptions","organizations_url":"https://api.github.com/users/drewhk/orgs","repos_url":"https://api.github.com/users/drewhk/repos","events_url":"https://api.github.com/users/drewhk/events{/privacy}","received_events_url":"https://api.github.com/users/drewhk/received_events","type":"User","site_admin":false},"body":"But the topic from which we consume has no natural end-of-stream marker, it might go on forever. I.e. stopping only makes sense if you need to shut down processing and then you have to deal with lost commits anyway.","created_at":"2016-03-18T10:55:53Z","updated_at":"2016-03-18T10:55:53Z","html_url":"https://github.com/akka/reactive-kafka/pull/113#discussion_r56640133","pull_request_url":"https://api.github.com/repos/akka/reactive-kafka/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/comments/56640133"},"html":{"href":"https://github.com/akka/reactive-kafka/pull/113#discussion_r56640133"},"pull_request":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/akka/reactive-kafka/pulls/113","id":63277557,"html_url":"https://github.com/akka/reactive-kafka/pull/113","diff_url":"https://github.com/akka/reactive-kafka/pull/113.diff","patch_url":"https://github.com/akka/reactive-kafka/pull/113.patch","issue_url":"https://api.github.com/repos/akka/reactive-kafka/issues/113","number":113,"state":"open","locked":false,"title":"API discussion","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"As a complement to the descriptions in https://github.com/akka/akka-meta/issues/13 and https://github.com/akka/akka-meta/issues/14 I have created API stubs for option 1 and 3 with example usage.\r\n\r\nLet's discuss!\r\n\r\nWhat other typical usage scenarios are there?","created_at":"2016-03-17T19:16:19Z","updated_at":"2016-03-18T10:55:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3ffbf4574ead528610d169d127cc46ff9ddd00b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/reactive-kafka/pulls/113/commits","review_comments_url":"https://api.github.com/repos/akka/reactive-kafka/pulls/113/comments","review_comment_url":"https://api.github.com/repos/akka/reactive-kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/reactive-kafka/issues/113/comments","statuses_url":"https://api.github.com/repos/akka/reactive-kafka/statuses/e7665c1e513507cf4282fbd86ac951cc8a28ed64","head":{"label":"patriknw:wip-api-patriknw","ref":"wip-api-patriknw","sha":"e7665c1e513507cf4282fbd86ac951cc8a28ed64","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"repo":{"id":53659645,"name":"reactive-kafka","full_name":"patriknw/reactive-kafka","owner":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/patriknw/reactive-kafka","description":"Reactive Streams API for Apache Kafka","fork":true,"url":"https://api.github.com/repos/patriknw/reactive-kafka","forks_url":"https://api.github.com/repos/patriknw/reactive-kafka/forks","keys_url":"https://api.github.com/repos/patriknw/reactive-kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/patriknw/reactive-kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/patriknw/reactive-kafka/teams","hooks_url":"https://api.github.com/repos/patriknw/reactive-kafka/hooks","issue_events_url":"https://api.github.com/repos/patriknw/reactive-kafka/issues/events{/number}","events_url":"https://api.github.com/repos/patriknw/reactive-kafka/events","assignees_url":"https://api.github.com/repos/patriknw/reactive-kafka/assignees{/user}","branches_url":"https://api.github.com/repos/patriknw/reactive-kafka/branches{/branch}","tags_url":"https://api.github.com/repos/patriknw/reactive-kafka/tags","blobs_url":"https://api.github.com/repos/patriknw/reactive-kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/patriknw/reactive-kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/patriknw/reactive-kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/patriknw/reactive-kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/patriknw/reactive-kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/patriknw/reactive-kafka/languages","stargazers_url":"https://api.github.com/repos/patriknw/reactive-kafka/stargazers","contributors_url":"https://api.github.com/repos/patriknw/reactive-kafka/contributors","subscribers_url":"https://api.github.com/repos/patriknw/reactive-kafka/subscribers","subscription_url":"https://api.github.com/repos/patriknw/reactive-kafka/subscription","commits_url":"https://api.github.com/repos/patriknw/reactive-kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/patriknw/reactive-kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/patriknw/reactive-kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/patriknw/reactive-kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/patriknw/reactive-kafka/contents/{+path}","compare_url":"https://api.github.com/repos/patriknw/reactive-kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/patriknw/reactive-kafka/merges","archive_url":"https://api.github.com/repos/patriknw/reactive-kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/patriknw/reactive-kafka/downloads","issues_url":"https://api.github.com/repos/patriknw/reactive-kafka/issues{/number}","pulls_url":"https://api.github.com/repos/patriknw/reactive-kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/patriknw/reactive-kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/patriknw/reactive-kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/patriknw/reactive-kafka/labels{/name}","releases_url":"https://api.github.com/repos/patriknw/reactive-kafka/releases{/id}","deployments_url":"https://api.github.com/repos/patriknw/reactive-kafka/deployments","created_at":"2016-03-11T10:33:25Z","updated_at":"2016-03-11T10:33:25Z","pushed_at":"2016-03-17T19:13:34Z","git_url":"git://github.com/patriknw/reactive-kafka.git","ssh_url":"git@github.com:patriknw/reactive-kafka.git","clone_url":"https://github.com/patriknw/reactive-kafka.git","svn_url":"https://github.com/patriknw/reactive-kafka","homepage":null,"size":611,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"c02b52c88d8b59caa3a705add883ac67d6ff7788","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":28635588,"name":"reactive-kafka","full_name":"akka/reactive-kafka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/reactive-kafka","description":"Reactive Streams API for Apache Kafka","fork":false,"url":"https://api.github.com/repos/akka/reactive-kafka","forks_url":"https://api.github.com/repos/akka/reactive-kafka/forks","keys_url":"https://api.github.com/repos/akka/reactive-kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/reactive-kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/reactive-kafka/teams","hooks_url":"https://api.github.com/repos/akka/reactive-kafka/hooks","issue_events_url":"https://api.github.com/repos/akka/reactive-kafka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/reactive-kafka/events","assignees_url":"https://api.github.com/repos/akka/reactive-kafka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/reactive-kafka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/reactive-kafka/tags","blobs_url":"https://api.github.com/repos/akka/reactive-kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/reactive-kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/reactive-kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/reactive-kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/reactive-kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/reactive-kafka/languages","stargazers_url":"https://api.github.com/repos/akka/reactive-kafka/stargazers","contributors_url":"https://api.github.com/repos/akka/reactive-kafka/contributors","subscribers_url":"https://api.github.com/repos/akka/reactive-kafka/subscribers","subscription_url":"https://api.github.com/repos/akka/reactive-kafka/subscription","commits_url":"https://api.github.com/repos/akka/reactive-kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/reactive-kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/reactive-kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/reactive-kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/reactive-kafka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/reactive-kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/reactive-kafka/merges","archive_url":"https://api.github.com/repos/akka/reactive-kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/reactive-kafka/downloads","issues_url":"https://api.github.com/repos/akka/reactive-kafka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/reactive-kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/reactive-kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/reactive-kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/reactive-kafka/labels{/name}","releases_url":"https://api.github.com/repos/akka/reactive-kafka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/reactive-kafka/deployments","created_at":"2014-12-30T15:30:02Z","updated_at":"2016-03-17T23:51:59Z","pushed_at":"2016-03-17T19:16:19Z","git_url":"git://github.com/akka/reactive-kafka.git","ssh_url":"git@github.com:akka/reactive-kafka.git","clone_url":"https://github.com/akka/reactive-kafka.git","svn_url":"https://github.com/akka/reactive-kafka","homepage":null,"size":617,"stargazers_count":427,"watchers_count":427,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":18,"forks":84,"open_issues":18,"watchers":427,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/113"},"html":{"href":"https://github.com/akka/reactive-kafka/pull/113"},"issue":{"href":"https://api.github.com/repos/akka/reactive-kafka/issues/113"},"comments":{"href":"https://api.github.com/repos/akka/reactive-kafka/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/reactive-kafka/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/akka/reactive-kafka/statuses/e7665c1e513507cf4282fbd86ac951cc8a28ed64"}}}}