{"action":"created","comment":{"url":"https://api.github.com/repos/corda/corda/pulls/comments/93415190","pull_request_review_id":13940913,"id":93415190,"diff_hunk":"@@ -139,4 +141,91 @@ class ObservablesTests {\n \n         toBeClosed.close()\n     }\n+\n+    @Test\n+    fun `new transaction open in observer when wrapped`() {\n+        val (toBeClosed, database) = configureDatabase(makeTestDataSourceProperties())\n+\n+        val subject = PublishSubject.create<Int>()\n+        val observable: Observable<Int> = subject.wrapWithDatabaseTransaction()\n+\n+        val firstEvent = SettableFuture.create<Pair<Int, Boolean>>()\n+        val secondEvent1 = SettableFuture.create<Pair<Int, UUID?>>()\n+        val secondEvent2 = SettableFuture.create<Pair<Int, UUID?>>()\n+\n+        observable.first().subscribe { firstEvent.set(it to isInDatabaseTransaction()) }\n+        observable.skip(1).first().subscribe { secondEvent1.set(it to if (isInDatabaseTransaction()) StrandLocalTransactionManager.transactionId else null) }\n+        observable.skip(1).first().subscribe { secondEvent2.set(it to if (isInDatabaseTransaction()) StrandLocalTransactionManager.transactionId else null) }\n+\n+        databaseTransaction(database) {\n+            val delayedSubject = subject.bufferUntilDatabaseCommit()\n+            assertThat(subject).isNotEqualTo(delayedSubject)\n+            delayedSubject.onNext(0)\n+            subject.onNext(1)\n+            assertThat(firstEvent.isDone).isTrue()\n+            assertThat(secondEvent1.isDone).isFalse()\n+        }\n+        assertThat(secondEvent1.isDone).isTrue()\n+\n+        assertThat(firstEvent.get()).isEqualTo(1 to true)","path":"node/src/test/kotlin/net/corda/node/utilities/ObservablesTests.kt","position":46,"original_position":46,"commit_id":"6906cfecfe0ba1c92899e263c1b03a5f09a0d781","original_commit_id":"6906cfecfe0ba1c92899e263c1b03a5f09a0d781","user":{"login":"rick-r3","id":23558791,"avatar_url":"https://avatars.githubusercontent.com/u/23558791?v=3","gravatar_id":"","url":"https://api.github.com/users/rick-r3","html_url":"https://github.com/rick-r3","followers_url":"https://api.github.com/users/rick-r3/followers","following_url":"https://api.github.com/users/rick-r3/following{/other_user}","gists_url":"https://api.github.com/users/rick-r3/gists{/gist_id}","starred_url":"https://api.github.com/users/rick-r3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rick-r3/subscriptions","organizations_url":"https://api.github.com/users/rick-r3/orgs","repos_url":"https://api.github.com/users/rick-r3/repos","events_url":"https://api.github.com/users/rick-r3/events{/privacy}","received_events_url":"https://api.github.com/users/rick-r3/received_events","type":"User","site_admin":false},"body":"No, it will block forever.","created_at":"2016-12-21T10:44:13Z","updated_at":"2016-12-21T10:44:13Z","html_url":"https://github.com/corda/corda/pull/77#discussion_r93415190","pull_request_url":"https://api.github.com/repos/corda/corda/pulls/77","_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/comments/93415190"},"html":{"href":"https://github.com/corda/corda/pull/77#discussion_r93415190"},"pull_request":{"href":"https://api.github.com/repos/corda/corda/pulls/77"}}},"pull_request":{"url":"https://api.github.com/repos/corda/corda/pulls/77","id":98605574,"html_url":"https://github.com/corda/corda/pull/77","diff_url":"https://github.com/corda/corda/pull/77.diff","patch_url":"https://github.com/corda/corda/pull/77.patch","issue_url":"https://api.github.com/repos/corda/corda/issues/77","number":77,"state":"open","locked":false,"title":"Add database transactions back onto observations.","user":{"login":"rick-r3","id":23558791,"avatar_url":"https://avatars.githubusercontent.com/u/23558791?v=3","gravatar_id":"","url":"https://api.github.com/users/rick-r3","html_url":"https://github.com/rick-r3","followers_url":"https://api.github.com/users/rick-r3/followers","following_url":"https://api.github.com/users/rick-r3/following{/other_user}","gists_url":"https://api.github.com/users/rick-r3/gists{/gist_id}","starred_url":"https://api.github.com/users/rick-r3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rick-r3/subscriptions","organizations_url":"https://api.github.com/users/rick-r3/orgs","repos_url":"https://api.github.com/users/rick-r3/repos","events_url":"https://api.github.com/users/rick-r3/events{/privacy}","received_events_url":"https://api.github.com/users/rick-r3/received_events","type":"User","site_admin":false},"body":"Having made the observations _post database commit_ the `Observers` no longer have access to a database transaction.  This change re-introduces a database transaction for the `Observers`, so that they can interact with the database as needed, but it is distinct from that being observed.\r\n\r\nMatthew encountered this when he updated to using the post-commit change.\r\n\r\nSeems like this should have been easier, using more built in functionality but, alas, no.","created_at":"2016-12-19T17:22:54Z","updated_at":"2016-12-21T10:44:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a5c31f2cc21ed8ca1552a6c72493a2fbf1079f8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/corda/corda/pulls/77/commits","review_comments_url":"https://api.github.com/repos/corda/corda/pulls/77/comments","review_comment_url":"https://api.github.com/repos/corda/corda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/corda/corda/issues/77/comments","statuses_url":"https://api.github.com/repos/corda/corda/statuses/6906cfecfe0ba1c92899e263c1b03a5f09a0d781","head":{"label":"corda:parkri-add-db-tx-to-observables","ref":"parkri-add-db-tx-to-observables","sha":"6906cfecfe0ba1c92899e263c1b03a5f09a0d781","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars.githubusercontent.com/u/22600631?v=3","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":70137417,"name":"corda","full_name":"corda/corda","owner":{"login":"corda","id":22600631,"avatar_url":"https://avatars.githubusercontent.com/u/22600631?v=3","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/corda/corda","description":"Corda is a distributed ledger platform designed to record, manage and automate legal agreements between business partners. Designed by (and for) the world's largest financial institutions, it offers a unique response to the privacy and scalability challenges facing decentralised applications.","fork":false,"url":"https://api.github.com/repos/corda/corda","forks_url":"https://api.github.com/repos/corda/corda/forks","keys_url":"https://api.github.com/repos/corda/corda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/corda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/corda/teams","hooks_url":"https://api.github.com/repos/corda/corda/hooks","issue_events_url":"https://api.github.com/repos/corda/corda/issues/events{/number}","events_url":"https://api.github.com/repos/corda/corda/events","assignees_url":"https://api.github.com/repos/corda/corda/assignees{/user}","branches_url":"https://api.github.com/repos/corda/corda/branches{/branch}","tags_url":"https://api.github.com/repos/corda/corda/tags","blobs_url":"https://api.github.com/repos/corda/corda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/corda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/corda/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/corda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/corda/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/corda/languages","stargazers_url":"https://api.github.com/repos/corda/corda/stargazers","contributors_url":"https://api.github.com/repos/corda/corda/contributors","subscribers_url":"https://api.github.com/repos/corda/corda/subscribers","subscription_url":"https://api.github.com/repos/corda/corda/subscription","commits_url":"https://api.github.com/repos/corda/corda/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/corda/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/corda/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/corda/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/corda/contents/{+path}","compare_url":"https://api.github.com/repos/corda/corda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/corda/merges","archive_url":"https://api.github.com/repos/corda/corda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/corda/downloads","issues_url":"https://api.github.com/repos/corda/corda/issues{/number}","pulls_url":"https://api.github.com/repos/corda/corda/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/corda/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/corda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/corda/labels{/name}","releases_url":"https://api.github.com/repos/corda/corda/releases{/id}","deployments_url":"https://api.github.com/repos/corda/corda/deployments","created_at":"2016-10-06T08:46:29Z","updated_at":"2016-12-21T08:41:18Z","pushed_at":"2016-12-21T10:20:57Z","git_url":"git://github.com/corda/corda.git","ssh_url":"git@github.com:corda/corda.git","clone_url":"https://github.com/corda/corda.git","svn_url":"https://github.com/corda/corda","homepage":"https://www.corda.net","size":53316,"stargazers_count":369,"watchers_count":369,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"open_issues_count":16,"forks":97,"open_issues":16,"watchers":369,"default_branch":"master"}},"base":{"label":"corda:master","ref":"master","sha":"4ffad426c11c74140f086d4b54da1441a3381772","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars.githubusercontent.com/u/22600631?v=3","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":70137417,"name":"corda","full_name":"corda/corda","owner":{"login":"corda","id":22600631,"avatar_url":"https://avatars.githubusercontent.com/u/22600631?v=3","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/corda/corda","description":"Corda is a distributed ledger platform designed to record, manage and automate legal agreements between business partners. Designed by (and for) the world's largest financial institutions, it offers a unique response to the privacy and scalability challenges facing decentralised applications.","fork":false,"url":"https://api.github.com/repos/corda/corda","forks_url":"https://api.github.com/repos/corda/corda/forks","keys_url":"https://api.github.com/repos/corda/corda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/corda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/corda/teams","hooks_url":"https://api.github.com/repos/corda/corda/hooks","issue_events_url":"https://api.github.com/repos/corda/corda/issues/events{/number}","events_url":"https://api.github.com/repos/corda/corda/events","assignees_url":"https://api.github.com/repos/corda/corda/assignees{/user}","branches_url":"https://api.github.com/repos/corda/corda/branches{/branch}","tags_url":"https://api.github.com/repos/corda/corda/tags","blobs_url":"https://api.github.com/repos/corda/corda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/corda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/corda/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/corda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/corda/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/corda/languages","stargazers_url":"https://api.github.com/repos/corda/corda/stargazers","contributors_url":"https://api.github.com/repos/corda/corda/contributors","subscribers_url":"https://api.github.com/repos/corda/corda/subscribers","subscription_url":"https://api.github.com/repos/corda/corda/subscription","commits_url":"https://api.github.com/repos/corda/corda/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/corda/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/corda/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/corda/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/corda/contents/{+path}","compare_url":"https://api.github.com/repos/corda/corda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/corda/merges","archive_url":"https://api.github.com/repos/corda/corda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/corda/downloads","issues_url":"https://api.github.com/repos/corda/corda/issues{/number}","pulls_url":"https://api.github.com/repos/corda/corda/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/corda/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/corda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/corda/labels{/name}","releases_url":"https://api.github.com/repos/corda/corda/releases{/id}","deployments_url":"https://api.github.com/repos/corda/corda/deployments","created_at":"2016-10-06T08:46:29Z","updated_at":"2016-12-21T08:41:18Z","pushed_at":"2016-12-21T10:20:57Z","git_url":"git://github.com/corda/corda.git","ssh_url":"git@github.com:corda/corda.git","clone_url":"https://github.com/corda/corda.git","svn_url":"https://github.com/corda/corda","homepage":"https://www.corda.net","size":53316,"stargazers_count":369,"watchers_count":369,"language":"Kotlin","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"open_issues_count":16,"forks":97,"open_issues":16,"watchers":369,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/77"},"html":{"href":"https://github.com/corda/corda/pull/77"},"issue":{"href":"https://api.github.com/repos/corda/corda/issues/77"},"comments":{"href":"https://api.github.com/repos/corda/corda/issues/77/comments"},"review_comments":{"href":"https://api.github.com/repos/corda/corda/pulls/77/comments"},"review_comment":{"href":"https://api.github.com/repos/corda/corda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/corda/corda/pulls/77/commits"},"statuses":{"href":"https://api.github.com/repos/corda/corda/statuses/6906cfecfe0ba1c92899e263c1b03a5f09a0d781"}}}}
{"actor":{"display_login":"rick-r3"}}