{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/comments/173539558","pull_request_review_id":102754919,"id":173539558,"diff_hunk":"@@ -0,0 +1,64 @@\n+﻿using Orleans.Configuration;\n+using Orleans.Hosting;\n+using OrleansAWSUtils.Streams;\n+using System;\n+using System.Collections.Generic;\n+using System.Text;\n+\n+namespace Orleans.Streams\n+{\n+    public class SiloSqsStreamConfigurator: SiloPersistentStreamConfigurator\n+    {\n+        public SiloSqsStreamConfigurator(string name, ISiloHostBuilder builder)\n+            : base(name, builder)\n+        {\n+            this.siloBuilder\n+                .ConfigureApplicationParts(parts => parts.AddFrameworkPart(typeof(SQSAdapterFactory).Assembly))\n+                .AddPersistentStreams(name, SQSAdapterFactory.Create)\n+                .ConfigureServices(services =>\n+                {\n+                    services.ConfigureNamedOptionForLogging<SqsOptions>(name)\n+                        .ConfigureNamedOptionForLogging<SimpleQueueCacheOptions>(name)\n+                        .ConfigureNamedOptionForLogging<HashRingStreamQueueMapperOptions>(name);\n+                });\n+        }\n+\n+        public SiloSqsStreamConfigurator ConfigureAzureQueue(Action<OptionsBuilder<SqsOptions>> configureOptions)\n+        {\n+            this.Configure<SqsOptions>(configureOptions);\n+            return this;\n+        }\n+        public SiloSqsStreamConfigurator ConfigureCacheSize(int cacheSize = SimpleQueueCacheOptions.DEFAULT_CACHE_SIZE)\n+        {\n+            this.Configure<SimpleQueueCacheOptions>(ob => ob.Configure(options => options.CacheSize = cacheSize));\n+            return this;\n+        }\n+\n+        public SiloSqsStreamConfigurator ConfigureQueueMapper(int numOfQueues = HashRingStreamQueueMapperOptions.DEFAULT_NUM_QUEUES)\n+        {\n+            this.Configure<HashRingStreamQueueMapperOptions>(ob => ob.Configure(options => options.NumQueues = numOfQueues));\n+            return this;\n+        }\n+    }\n+\n+    public class ClusterClientSqsStreamConfigurator : ClusterClientPersistentStreamConfigurator\n+    {\n+        public ClusterClientSqsStreamConfigurator(string name, IClientBuilder builder)","path":"src/AWS/Orleans.Streaming.SQS/Streams/SQSStreamBuilder.cs","position":45,"original_position":46,"commit_id":"8ba8764a90e7a6ea0cb7e1b931bec61dfe9a28ec","original_commit_id":"d02bacbe81768932ff8daf56540ca2abacb20b11","user":{"login":"jason-bragg","id":10675494,"avatar_url":"https://avatars2.githubusercontent.com/u/10675494?v=4","gravatar_id":"","url":"https://api.github.com/users/jason-bragg","html_url":"https://github.com/jason-bragg","followers_url":"https://api.github.com/users/jason-bragg/followers","following_url":"https://api.github.com/users/jason-bragg/following{/other_user}","gists_url":"https://api.github.com/users/jason-bragg/gists{/gist_id}","starred_url":"https://api.github.com/users/jason-bragg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jason-bragg/subscriptions","organizations_url":"https://api.github.com/users/jason-bragg/orgs","repos_url":"https://api.github.com/users/jason-bragg/repos","events_url":"https://api.github.com/users/jason-bragg/events{/privacy}","received_events_url":"https://api.github.com/users/jason-bragg/received_events","type":"User","site_admin":false},"body":"Client needs to know about the queue count as well (mapper settings), as it uses the mapper to determine which queues to send messages too.  This is probably the case with all stream providers that have configurable numbers of queues (azure, memory, ..)","created_at":"2018-03-09T19:07:14Z","updated_at":"2018-03-09T19:07:14Z","html_url":"https://github.com/dotnet/orleans/pull/4164#discussion_r173539558","pull_request_url":"https://api.github.com/repos/dotnet/orleans/pulls/4164","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments/173539558"},"html":{"href":"https://github.com/dotnet/orleans/pull/4164#discussion_r173539558"},"pull_request":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/4164"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/4164","id":173656558,"html_url":"https://github.com/dotnet/orleans/pull/4164","diff_url":"https://github.com/dotnet/orleans/pull/4164.diff","patch_url":"https://github.com/dotnet/orleans/pull/4164.patch","issue_url":"https://api.github.com/repos/dotnet/orleans/issues/4164","number":4164,"state":"open","locked":false,"title":"[WIP] Persistent stream configurators","user":{"login":"xiazen","id":20803801,"avatar_url":"https://avatars3.githubusercontent.com/u/20803801?v=4","gravatar_id":"","url":"https://api.github.com/users/xiazen","html_url":"https://github.com/xiazen","followers_url":"https://api.github.com/users/xiazen/followers","following_url":"https://api.github.com/users/xiazen/following{/other_user}","gists_url":"https://api.github.com/users/xiazen/gists{/gist_id}","starred_url":"https://api.github.com/users/xiazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiazen/subscriptions","organizations_url":"https://api.github.com/users/xiazen/orgs","repos_url":"https://api.github.com/users/xiazen/repos","events_url":"https://api.github.com/users/xiazen/events{/privacy}","received_events_url":"https://api.github.com/users/xiazen/received_events","type":"User","site_admin":false},"body":"Attempt to solve issue #4080 \r\n\r\nMajor interface and configurator class and its inheritance hierarchy\r\nSilo side: \r\n```\r\n//main interface and implementation\r\ninterface ISiloPersistentStreamConfigurator\r\ninterface IRecoverableStreamConfigurator:  ISiloPersistentStreamConfigurator\r\nclass SiloPersistentStreamConfigurator : ISiloPersistentStreamConfigurator\r\nclass SiloRecoverableStreamConfigurator : SiloPersistentStreamConfigurator \r\n\r\n//specific stream configurator\r\nclass SiloAzureQueueStreamConfigurator : SiloPersistentStreamConfigurator\r\nclass SiloEventHubStreamConfigurator : SiloRecoverableStreamConfigurator\r\n..and other stream providers are similar \r\n```\r\nClient side:\r\n```\r\n//main interface and implementation\r\ninterface IClusterClientPersistentStreamConfigurator\r\nclass ClusterClientPersistentStreamConfigurator : IClusterClientPersistentStreamConfigurator\r\n\r\n//specific stream configurator\r\nclass ClusterClientAzureQueueStreamConfigurator : ClusterClientPersistentStreamConfigurator\r\nclass ClusetrClientEventHubStreamConfigurator : ClusterClientPersistentStreamConfigurator\r\n\r\n..and other stream providers are similar \r\n```\r\nThe main idea is to use configurator/builder pattern to achieve a cleaner configuring pattern. Stream providers are complex which has many components, this PR try to use configurator/builder pattern to make configuring more modular, aka per component configuring. \r\n\r\nStream providers are complex , where named service and named options can be utilized to make stream provider cleaner. But Rome isn't built in one day, we cannot make stream provider great in one day. So the strategy I propose here is to hide stream provider configuration under a builder pattern. So from the public surface, stream provider is already very modular. Under the public surface, we can make stream providers more modular without introducing much breaking changes. \r\n\r\nSample call pattern:\r\n```\r\n  hostBuilder\r\n  .AddAzureQueueStreams<AzureQueueDataAdapterV2>(StreamProviderName)\r\n   .ConfigureAzureQueue(ob => ob.Configure(\r\n                            options =>\r\n                            {\r\n                                options.ConnectionString = TestDefaultConfiguration.DataConnectionString;\r\n                            }));\r\n```\r\n","created_at":"2018-03-08T06:35:08Z","updated_at":"2018-03-09T19:07:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e500f210443fa1ef6e60862479fb0f0565ca2a6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/dotnet/orleans/milestones/13","html_url":"https://github.com/dotnet/orleans/milestone/13","labels_url":"https://api.github.com/repos/dotnet/orleans/milestones/13/labels","id":1873066,"number":13,"title":"2.0.0","description":"Key target is compatibility with .NET Core.","creator":{"login":"sergeybykov","id":8248806,"avatar_url":"https://avatars1.githubusercontent.com/u/8248806?v=4","gravatar_id":"","url":"https://api.github.com/users/sergeybykov","html_url":"https://github.com/sergeybykov","followers_url":"https://api.github.com/users/sergeybykov/followers","following_url":"https://api.github.com/users/sergeybykov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybykov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybykov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybykov/subscriptions","organizations_url":"https://api.github.com/users/sergeybykov/orgs","repos_url":"https://api.github.com/users/sergeybykov/repos","events_url":"https://api.github.com/users/sergeybykov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybykov/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":187,"state":"open","created_at":"2016-07-08T21:14:40Z","updated_at":"2018-03-09T18:01:20Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dotnet/orleans/pulls/4164/commits","review_comments_url":"https://api.github.com/repos/dotnet/orleans/pulls/4164/comments","review_comment_url":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/orleans/issues/4164/comments","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/8ba8764a90e7a6ea0cb7e1b931bec61dfe9a28ec","head":{"label":"xiazen:p-stream-builder","ref":"p-stream-builder","sha":"8ba8764a90e7a6ea0cb7e1b931bec61dfe9a28ec","user":{"login":"xiazen","id":20803801,"avatar_url":"https://avatars3.githubusercontent.com/u/20803801?v=4","gravatar_id":"","url":"https://api.github.com/users/xiazen","html_url":"https://github.com/xiazen","followers_url":"https://api.github.com/users/xiazen/followers","following_url":"https://api.github.com/users/xiazen/following{/other_user}","gists_url":"https://api.github.com/users/xiazen/gists{/gist_id}","starred_url":"https://api.github.com/users/xiazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiazen/subscriptions","organizations_url":"https://api.github.com/users/xiazen/orgs","repos_url":"https://api.github.com/users/xiazen/repos","events_url":"https://api.github.com/users/xiazen/events{/privacy}","received_events_url":"https://api.github.com/users/xiazen/received_events","type":"User","site_admin":false},"repo":{"id":66402876,"name":"orleans","full_name":"xiazen/orleans","owner":{"login":"xiazen","id":20803801,"avatar_url":"https://avatars3.githubusercontent.com/u/20803801?v=4","gravatar_id":"","url":"https://api.github.com/users/xiazen","html_url":"https://github.com/xiazen","followers_url":"https://api.github.com/users/xiazen/followers","following_url":"https://api.github.com/users/xiazen/following{/other_user}","gists_url":"https://api.github.com/users/xiazen/gists{/gist_id}","starred_url":"https://api.github.com/users/xiazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiazen/subscriptions","organizations_url":"https://api.github.com/users/xiazen/orgs","repos_url":"https://api.github.com/users/xiazen/repos","events_url":"https://api.github.com/users/xiazen/events{/privacy}","received_events_url":"https://api.github.com/users/xiazen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xiazen/orleans","description":"Orleans - Distributed Virtual Actor Model","fork":true,"url":"https://api.github.com/repos/xiazen/orleans","forks_url":"https://api.github.com/repos/xiazen/orleans/forks","keys_url":"https://api.github.com/repos/xiazen/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xiazen/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xiazen/orleans/teams","hooks_url":"https://api.github.com/repos/xiazen/orleans/hooks","issue_events_url":"https://api.github.com/repos/xiazen/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/xiazen/orleans/events","assignees_url":"https://api.github.com/repos/xiazen/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/xiazen/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/xiazen/orleans/tags","blobs_url":"https://api.github.com/repos/xiazen/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xiazen/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xiazen/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/xiazen/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xiazen/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/xiazen/orleans/languages","stargazers_url":"https://api.github.com/repos/xiazen/orleans/stargazers","contributors_url":"https://api.github.com/repos/xiazen/orleans/contributors","subscribers_url":"https://api.github.com/repos/xiazen/orleans/subscribers","subscription_url":"https://api.github.com/repos/xiazen/orleans/subscription","commits_url":"https://api.github.com/repos/xiazen/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/xiazen/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/xiazen/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/xiazen/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/xiazen/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/xiazen/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xiazen/orleans/merges","archive_url":"https://api.github.com/repos/xiazen/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xiazen/orleans/downloads","issues_url":"https://api.github.com/repos/xiazen/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/xiazen/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/xiazen/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/xiazen/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xiazen/orleans/labels{/name}","releases_url":"https://api.github.com/repos/xiazen/orleans/releases{/id}","deployments_url":"https://api.github.com/repos/xiazen/orleans/deployments","created_at":"2016-08-23T20:59:50Z","updated_at":"2016-11-03T01:51:16Z","pushed_at":"2018-03-09T03:18:37Z","git_url":"git://github.com/xiazen/orleans.git","ssh_url":"git@github.com:xiazen/orleans.git","clone_url":"https://github.com/xiazen/orleans.git","svn_url":"https://github.com/xiazen/orleans","homepage":"http://dotnet.github.io/orleans","size":45537,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"566e409dbd396f700ddbf96c5f96fdd9627faf3e","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":28232663,"name":"orleans","full_name":"dotnet/orleans","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/orleans","description":"Orleans - Distributed Virtual Actor Model","fork":false,"url":"https://api.github.com/repos/dotnet/orleans","forks_url":"https://api.github.com/repos/dotnet/orleans/forks","keys_url":"https://api.github.com/repos/dotnet/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/orleans/teams","hooks_url":"https://api.github.com/repos/dotnet/orleans/hooks","issue_events_url":"https://api.github.com/repos/dotnet/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/orleans/events","assignees_url":"https://api.github.com/repos/dotnet/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/orleans/tags","blobs_url":"https://api.github.com/repos/dotnet/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/orleans/languages","stargazers_url":"https://api.github.com/repos/dotnet/orleans/stargazers","contributors_url":"https://api.github.com/repos/dotnet/orleans/contributors","subscribers_url":"https://api.github.com/repos/dotnet/orleans/subscribers","subscription_url":"https://api.github.com/repos/dotnet/orleans/subscription","commits_url":"https://api.github.com/repos/dotnet/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/orleans/merges","archive_url":"https://api.github.com/repos/dotnet/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/orleans/downloads","issues_url":"https://api.github.com/repos/dotnet/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/orleans/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/orleans/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/orleans/deployments","created_at":"2014-12-19T14:32:50Z","updated_at":"2018-03-09T18:21:53Z","pushed_at":"2018-03-09T18:54:08Z","git_url":"git://github.com/dotnet/orleans.git","ssh_url":"git@github.com:dotnet/orleans.git","clone_url":"https://github.com/dotnet/orleans.git","svn_url":"https://github.com/dotnet/orleans","homepage":"http://dotnet.github.io/orleans","size":45793,"stargazers_count":3625,"watchers_count":3625,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":890,"mirror_url":null,"archived":false,"open_issues_count":337,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":890,"open_issues":337,"watchers":3625,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/4164"},"html":{"href":"https://github.com/dotnet/orleans/pull/4164"},"issue":{"href":"https://api.github.com/repos/dotnet/orleans/issues/4164"},"comments":{"href":"https://api.github.com/repos/dotnet/orleans/issues/4164/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/4164/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/4164/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/orleans/statuses/8ba8764a90e7a6ea0cb7e1b931bec61dfe9a28ec"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jason-bragg"}}