{"action":"created","comment":{"url":"https://api.github.com/repos/corda/corda/pulls/comments/115984589","pull_request_review_id":37569558,"id":115984589,"diff_hunk":"@@ -399,15 +399,50 @@ This code is longer but no more complicated. Here are some things to pay attenti\n As you can see, the flow logic is straightforward and does not contain any callbacks or network glue code, despite\n the fact that it takes minimal resources and can survive node restarts.\n \n-Initiating communication\n-------------------------\n-\n-Now that we have both sides of the deal negotation implemented as flows we need a way to start things off. We do this by\n-having one side initiate communication and the other respond to it and start their flow. Initiation is typically done using\n-RPC with the ``startFlowDynamic`` method. The initiating flow has be to annotated with ``InitiatingFlow``. In our example\n-it doesn't matter which flow is the initiator and which is the initiated, which is why neither ``Buyer`` nor ``Seller``\n-are annotated with it. For example, if we choose the seller side as the initiator then we need a seller starter flow that\n-might look something like this:\n+Flow sessions\n+-------------\n+\n+Before going any further it will be useful to describe how flows communicate with each other. A node may have many flows\n+running at the same time, and perhaps communicating with the same counterparty node but for different purposes. Therefore\n+flows need a way to segregate communication channels so that concurrent conversations between flows on the same set of nodes\n+do not interfere with each other.\n+\n+To achieve this the flow framework initiates a new flow session each time a flow starts communicating with a ``Party``\n+for the first time. A session is simply a pair of IDs, one for each side, to allow the node to route received messages to\n+the correct flow. If the other side accepts the session request then subsequent sends and receives to that same ``Party``\n+will use the same session. A session ends when either flow ends, whether as expected or pre-maturely. If a flow ends\n+pre-maturely then the other side will be notified of that and they will also end, as the whole point of flows is a known\n+sequence of message transfers. Flows end pre-maturely due to exceptions, and as described above, if that exception is\n+``FlowException`` or a sub-type then it will propagate to the other side. Any other exception will not propagate but will\n+be logged.\n+\n+Taking a step back, we mentioned that the other side has to accept the session request for there to be a communication\n+channel. A node accepts a session request if it has registered the flow type (the fully-qualified class name) that is\n+making the request - each session initiation includes the initiating flow type. The registration is done by a CorDapp\n+which has made available the particular flow communication, using ``PluginServiceHub.registerServiceFlow``. This method\n+specifies a flow factory for generating the counter-flow to any given initiating flow. If this registration doesn't exist\n+then no further communication takes place and the initiating flow ends with an exception. The initiating flow has to be\n+annotated with ``InitiatingFlow``.\n+\n+To recap, once a session has been estabished with a ``Party`` any subsequent sends or receives will be done on that session.","path":"docs/source/flow-state-machines.rst","position":null,"original_position":51,"commit_id":"20ac166f5e7d4da8208e607a521fab52ca1925a2","original_commit_id":"2583b50cecf8b5be8bbc4f1b47cd73fb93183bf6","user":{"login":"shamsasari","id":3883563,"avatar_url":"https://avatars0.githubusercontent.com/u/3883563?v=3","gravatar_id":"","url":"https://api.github.com/users/shamsasari","html_url":"https://github.com/shamsasari","followers_url":"https://api.github.com/users/shamsasari/followers","following_url":"https://api.github.com/users/shamsasari/following{/other_user}","gists_url":"https://api.github.com/users/shamsasari/gists{/gist_id}","starred_url":"https://api.github.com/users/shamsasari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shamsasari/subscriptions","organizations_url":"https://api.github.com/users/shamsasari/orgs","repos_url":"https://api.github.com/users/shamsasari/repos","events_url":"https://api.github.com/users/shamsasari/events{/privacy}","received_events_url":"https://api.github.com/users/shamsasari/received_events","type":"User","site_admin":false},"body":"The obvious thing to do is bump the parent flow's version number. ","created_at":"2017-05-11T13:07:49Z","updated_at":"2017-05-11T13:07:49Z","html_url":"https://github.com/corda/corda/pull/663#discussion_r115984589","pull_request_url":"https://api.github.com/repos/corda/corda/pulls/663","_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/comments/115984589"},"html":{"href":"https://github.com/corda/corda/pull/663#discussion_r115984589"},"pull_request":{"href":"https://api.github.com/repos/corda/corda/pulls/663"}}},"pull_request":{"url":"https://api.github.com/repos/corda/corda/pulls/663","id":119851058,"html_url":"https://github.com/corda/corda/pull/663","diff_url":"https://github.com/corda/corda/pull/663.diff","patch_url":"https://github.com/corda/corda/pull/663.patch","issue_url":"https://api.github.com/repos/corda/corda/issues/663","number":663,"state":"open","locked":false,"title":"Introducing StartableByRPC and SchedulableFlow annotations, needed by…","user":{"login":"shamsasari","id":3883563,"avatar_url":"https://avatars0.githubusercontent.com/u/3883563?v=3","gravatar_id":"","url":"https://api.github.com/users/shamsasari","html_url":"https://github.com/shamsasari","followers_url":"https://api.github.com/users/shamsasari/followers","following_url":"https://api.github.com/users/shamsasari/following{/other_user}","gists_url":"https://api.github.com/users/shamsasari/gists{/gist_id}","starred_url":"https://api.github.com/users/shamsasari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shamsasari/subscriptions","organizations_url":"https://api.github.com/users/shamsasari/orgs","repos_url":"https://api.github.com/users/shamsasari/repos","events_url":"https://api.github.com/users/shamsasari/events{/privacy}","received_events_url":"https://api.github.com/users/shamsasari/received_events","type":"User","site_admin":false},"body":"… flows started via RPC and schedulable flows respectively.\r\n\r\nCordaPluginRegistry.requiredFlows is no longer needed as a result.","created_at":"2017-05-10T10:33:19Z","updated_at":"2017-05-11T13:07:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7985e214ca9f211c937a913b53ef603ca42b22f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rick-r3","id":23558791,"avatar_url":"https://avatars1.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}],"milestone":null,"commits_url":"https://api.github.com/repos/corda/corda/pulls/663/commits","review_comments_url":"https://api.github.com/repos/corda/corda/pulls/663/comments","review_comment_url":"https://api.github.com/repos/corda/corda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/corda/corda/issues/663/comments","statuses_url":"https://api.github.com/repos/corda/corda/statuses/20ac166f5e7d4da8208e607a521fab52ca1925a2","head":{"label":"corda:shams-flow-rpc-annotation","ref":"shams-flow-rpc-annotation","sha":"20ac166f5e7d4da8208e607a521fab52ca1925a2","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars2.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://avatars2.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":"2017-05-11T05:50:56Z","pushed_at":"2017-05-11T12:58:47Z","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":76627,"stargazers_count":593,"watchers_count":593,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"open_issues_count":54,"forks":192,"open_issues":54,"watchers":593,"default_branch":"master"}},"base":{"label":"corda:master","ref":"master","sha":"6e1a7346dde218d6fed528e22c9cfb70199a885b","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars2.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://avatars2.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":"2017-05-11T05:50:56Z","pushed_at":"2017-05-11T12:58:47Z","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":76627,"stargazers_count":593,"watchers_count":593,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"open_issues_count":54,"forks":192,"open_issues":54,"watchers":593,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/663"},"html":{"href":"https://github.com/corda/corda/pull/663"},"issue":{"href":"https://api.github.com/repos/corda/corda/issues/663"},"comments":{"href":"https://api.github.com/repos/corda/corda/issues/663/comments"},"review_comments":{"href":"https://api.github.com/repos/corda/corda/pulls/663/comments"},"review_comment":{"href":"https://api.github.com/repos/corda/corda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/corda/corda/pulls/663/commits"},"statuses":{"href":"https://api.github.com/repos/corda/corda/statuses/20ac166f5e7d4da8208e607a521fab52ca1925a2"}}}}
{"actor":{"display_login":"shamsasari"}}