{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/37166496","id":37166496,"diff_hunk":"@@ -0,0 +1,212 @@\n+/*\n+ * Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>\n+ */\n+\n+package docs.persistence.query\n+\n+import akka.actor._\n+import akka.persistence.query.scaladsl.ReadJournal\n+import akka.persistence.{ Recovery, PersistentActor }\n+import akka.persistence.query._\n+import akka.stream.{ FlowShape, ActorMaterializer }\n+import akka.stream.scaladsl.FlowGraph\n+import akka.stream.scaladsl.{ Flow, Sink, Source }\n+import akka.testkit.AkkaSpec\n+import akka.util.Timeout\n+import docs.persistence.query.PersistenceQueryDocSpec.TheOneWhoWritesToQueryJournal\n+\n+import scala.collection.immutable\n+import scala.concurrent.Future\n+import scala.concurrent.duration.FiniteDuration\n+import scala.concurrent.duration._\n+\n+object PersistenceQueryDocSpec {\n+\n+  implicit val timeout = Timeout(3.seconds)\n+\n+  class NoopReadJournal(sys: ExtendedActorSystem) extends ReadJournal {\n+    override def query[T, M](q: Query[T, M], hints: Hint*): Source[T, M] =\n+      Source.empty.mapMaterializedValue(_ => null.asInstanceOf[M])\n+  }\n+\n+  //#my-read-journal\n+  class MyReadJournal(system: ExtendedActorSystem) extends ReadJournal {\n+\n+    // TODO from config\n+    private val defaulRefreshInterval: FiniteDuration = 3.seconds\n+\n+    override def query[T, M](q: Query[T, M], hints: Hint*): Source[T, M] =\n+      q match {\n+        case EventsByTag(tag, offset) ⇒\n+          val props = MyEventsByTagPublisher.props(tag, offset, refreshInterval(hints))\n+          Source.actorPublisher[EventEnvelope](props)\n+            .mapMaterializedValue(_ ⇒ noMaterializedValue)","path":"akka-docs/rst/scala/code/docs/persistence/query/PersistenceQueryDocSpec.scala","position":38,"original_position":43,"commit_id":"3314de4cb92fe61559937a7c07e853755d9fa561","original_commit_id":"58da28f8b0a01eb02760899ffcea609cc77f18b4","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"Thanks, that's great feedback @scullxbones - we're not completely happy yet with the API, so all kinds of ideas are very welcome.\r\nInitially we thought that the same API should be implementable from Java as well as Scala, but since we have javadsl and scaladsl separate anyway, maybe we can go ahead and make the Scala API something nice (and make Java \"as good as possible\").\r\n\r\nI have created a new ticket to gather feedback, I'll copy your comment there so that it does not get lost => https://github.com/akka/akka/issues/18229","created_at":"2015-08-17T08:21:36Z","updated_at":"2015-08-17T08:21:36Z","html_url":"https://github.com/akka/akka/pull/18051#discussion_r37166496","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/18051","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/37166496"},"html":{"href":"https://github.com/akka/akka/pull/18051#discussion_r37166496"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/18051"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/18051","id":40551521,"html_url":"https://github.com/akka/akka/pull/18051","diff_url":"https://github.com/akka/akka/pull/18051.diff","patch_url":"https://github.com/akka/akka/pull/18051.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/18051","number":18051,"state":"closed","locked":false,"title":"+per #16541 initial version of the Persistence Query module","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"Ladies and Gentlemen,\r\nThanks to the [Akka Streams 1.0 release last week](http://akka.io/news/2015/07/15/akka-streams-1.0-released.html), we now would like to present this new experimental module for initial feedback, addressing a long history of discussions and awesome feedback we have gathered from the community (see the great summary: [Akka Persistence on the Query Side: The Conclusion](https://groups.google.com/forum/#!topic/akka-user/MNDc9cVG1To)). \r\n\r\nIntroducing the Akka Streams based improved Query Side to Akka Persistence.\r\nThis is only the initial PR, more examples, polish and example implementations will be pushed soon.\r\n\r\nThe current form of the API is the culmination of these discussions with the community, a very long \"maturing in the back of your mind\" process and a few days spent together around ScalaDays for polishing and trying it out in various example/mock implementations with @patriknw and @dotta. \r\n\r\nThe API is intentionally very \"open\" (we provide the marker traits `Query[T, M]`, `Hint`, and a number of basic case classes), because we do not want to restrict some of the great journals out there - instead, we want to encourage various implementations to expose that kind of API which is best suited for the underlying store. For example, SQL based journals may provide `SqlQuery(\"SELECT * ...\")` if that's what they want to expose. Journals will have to document their behaviours very thoroughly.\r\n\r\n\r\nOther important information:\r\n- this module (`akka-persistence-query-experimental`) will be (and stay) **experimental** in Akka `2.4`\r\n- we'll provide a number of *example* `ReadJournal` implementations, however we currently do not intend to maintain one for production usage - we ask the community to help out, similarily like it has happened organically with Akka Persistence.\r\n- integration with the new `EventAdapter`s known from the write-side in Akka 2.4 is under discussion/development https://github.com/akka/akka/issues/18050","created_at":"2015-07-22T10:39:55Z","updated_at":"2015-08-17T08:21:36Z","closed_at":"2015-08-12T20:14:44Z","merged_at":"2015-08-12T20:14:44Z","merge_commit_sha":"e87bb729bb80a7af1f410b9e3f186bbb8494767d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/18051/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/18051/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/18051/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/3314de4cb92fe61559937a7c07e853755d9fa561","head":{"label":"akka:wip-16541-persistence-query","ref":"wip-16541-persistence-query","sha":"3314de4cb92fe61559937a7c07e853755d9fa561","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":130013,"name":"akka","full_name":"akka/akka","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/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","created_at":"2009-02-16T12:51:54Z","updated_at":"2015-08-17T06:54:21Z","pushed_at":"2015-08-17T08:12:36Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":267602,"stargazers_count":4334,"watchers_count":4334,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1267,"mirror_url":null,"open_issues_count":698,"forks":1267,"open_issues":698,"watchers":4334,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"5c5decf0b13059869af64ebdc99377c22f287a8e","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":130013,"name":"akka","full_name":"akka/akka","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/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","created_at":"2009-02-16T12:51:54Z","updated_at":"2015-08-17T06:54:21Z","pushed_at":"2015-08-17T08:12:36Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":267602,"stargazers_count":4334,"watchers_count":4334,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1267,"mirror_url":null,"open_issues_count":698,"forks":1267,"open_issues":698,"watchers":4334,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/18051"},"html":{"href":"https://github.com/akka/akka/pull/18051"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/18051"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/18051/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/18051/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/18051/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/3314de4cb92fe61559937a7c07e853755d9fa561"}}}}