{"action":"created","comment":{"url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/comments/81668278","pull_request_review_id":2629764,"id":81668278,"diff_hunk":"@@ -0,0 +1,108 @@\n+package zipkin.collector.sqs;\n+\n+import com.amazonaws.auth.AWSCredentialsProvider;\n+import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;\n+import com.amazonaws.services.sqs.AmazonSQSClient;\n+import zipkin.collector.Collector;\n+import zipkin.collector.CollectorComponent;\n+import zipkin.collector.CollectorMetrics;\n+import zipkin.collector.CollectorSampler;\n+import zipkin.internal.Util;\n+import zipkin.storage.StorageComponent;\n+\n+import java.io.Closeable;\n+import java.io.IOException;\n+\n+public class SqsCollector implements CollectorComponent, Closeable {\n+\n+    private Collector collector;\n+    private CollectorMetrics metrics;\n+\n+    private AWSCredentialsProvider credentialsProvider;\n+    private String sqsQueueUrl;\n+    private int waitTimeSeconds;\n+\n+    private AmazonSQSClient client;\n+\n+    public SqsCollector(Builder builder) {\n+        collector = builder.delegate.build();\n+        metrics = builder.metrics;\n+        credentialsProvider = builder.credentialsProvider;\n+        sqsQueueUrl = builder.sqsQueueUrl;\n+        waitTimeSeconds = builder.waitTimeSeconds;\n+    }\n+\n+    public static Builder builder() {\n+        return new Builder();\n+    }\n+\n+    public static final class Builder implements CollectorComponent.Builder {\n+        Collector.Builder delegate = Collector.builder(SqsCollector.class);\n+        CollectorMetrics metrics = CollectorMetrics.NOOP_METRICS;\n+\n+        String sqsQueueUrl;\n+        int waitTimeSeconds = 1;\n+        AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain();\n+\n+        @Override\n+        public CollectorComponent.Builder storage(StorageComponent storage) {\n+            delegate.storage(storage);\n+            return this;\n+        }\n+\n+        @Override\n+        public CollectorComponent.Builder metrics(CollectorMetrics metrics) {\n+            this.metrics = Util.checkNotNull(metrics, \"metrics\").forTransport(\"sqs\");\n+            delegate.metrics(metrics);\n+            return this;\n+        }\n+\n+        @Override\n+        public CollectorComponent.Builder sampler(CollectorSampler sampler) {\n+            delegate.sampler(sampler);\n+            return this;\n+        }\n+\n+        public Builder sqsQueueUrl(String sqsQueueUrl) {\n+            this.sqsQueueUrl = sqsQueueUrl;\n+            return this;\n+        }\n+\n+        public Builder awsCredentialsProvider(AWSCredentialsProvider awsCredentialsProvider) {\n+            this.credentialsProvider = awsCredentialsProvider;\n+            return this;\n+        }\n+\n+        public Builder waitTimeSeconds(int waitTimeSeconds) {\n+            this.waitTimeSeconds = waitTimeSeconds;\n+            return this;\n+        }\n+\n+        @Override\n+        public SqsCollector build() {\n+            return new SqsCollector(this);\n+        }\n+\n+        Builder() {\n+        }\n+    }\n+\n+    @Override\n+    public CollectorComponent start() {\n+        client = new AmazonSQSClient(credentialsProvider);","path":"collector-sqs/src/main/java/zipkin/collector/sqs/SqsCollector.java","position":92,"original_position":92,"commit_id":"caf6d640721d6fc530ab34a1187dd7b93a9c72bb","original_commit_id":"caf6d640721d6fc530ab34a1187dd7b93a9c72bb","user":{"login":"llinder","id":99359,"avatar_url":"https://avatars.githubusercontent.com/u/99359?v=3","gravatar_id":"","url":"https://api.github.com/users/llinder","html_url":"https://github.com/llinder","followers_url":"https://api.github.com/users/llinder/followers","following_url":"https://api.github.com/users/llinder/following{/other_user}","gists_url":"https://api.github.com/users/llinder/gists{/gist_id}","starred_url":"https://api.github.com/users/llinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llinder/subscriptions","organizations_url":"https://api.github.com/users/llinder/orgs","repos_url":"https://api.github.com/users/llinder/repos","events_url":"https://api.github.com/users/llinder/events{/privacy}","received_events_url":"https://api.github.com/users/llinder/received_events","type":"User","site_admin":false},"body":"Something I just learned about is that the `AmazonSQSBufferedAsyncClient.recieveMessages` method prefetches and buffers messages on configurable background threads.  This could have the advantage of increasing throughput on the SqsStreamProcessor since the SQS API calls won't be blocked by work done on the `SqsStreamProcessor.run` method.\r\n\r\nDo you have thoughts or concerns for using the AmazonSQSBufferedAsyncClient here instead?","created_at":"2016-10-04T00:29:18Z","updated_at":"2016-10-04T00:47:43Z","html_url":"https://github.com/openzipkin/zipkin-aws/pull/6#discussion_r81668278","pull_request_url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/comments/81668278"},"html":{"href":"https://github.com/openzipkin/zipkin-aws/pull/6#discussion_r81668278"},"pull_request":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6","id":87519156,"html_url":"https://github.com/openzipkin/zipkin-aws/pull/6","diff_url":"https://github.com/openzipkin/zipkin-aws/pull/6.diff","patch_url":"https://github.com/openzipkin/zipkin-aws/pull/6.patch","issue_url":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/6","number":6,"state":"open","locked":false,"title":"Sqs collector","user":{"login":"devinsba","id":139938,"avatar_url":"https://avatars.githubusercontent.com/u/139938?v=3","gravatar_id":"","url":"https://api.github.com/users/devinsba","html_url":"https://github.com/devinsba","followers_url":"https://api.github.com/users/devinsba/followers","following_url":"https://api.github.com/users/devinsba/following{/other_user}","gists_url":"https://api.github.com/users/devinsba/gists{/gist_id}","starred_url":"https://api.github.com/users/devinsba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devinsba/subscriptions","organizations_url":"https://api.github.com/users/devinsba/orgs","repos_url":"https://api.github.com/users/devinsba/repos","events_url":"https://api.github.com/users/devinsba/events{/privacy}","received_events_url":"https://api.github.com/users/devinsba/received_events","type":"User","site_admin":false},"body":"Create the collector component for SQS","created_at":"2016-09-30T15:51:59Z","updated_at":"2016-10-04T00:47:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16a3ab8dad15a68be4843877704477f4a4a119d0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6/commits","review_comments_url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6/comments","review_comment_url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/6/comments","statuses_url":"https://api.github.com/repos/openzipkin/zipkin-aws/statuses/caf6d640721d6fc530ab34a1187dd7b93a9c72bb","head":{"label":"DealerDotCom:sqs-collector","ref":"sqs-collector","sha":"caf6d640721d6fc530ab34a1187dd7b93a9c72bb","user":{"login":"DealerDotCom","id":1919423,"avatar_url":"https://avatars.githubusercontent.com/u/1919423?v=3","gravatar_id":"","url":"https://api.github.com/users/DealerDotCom","html_url":"https://github.com/DealerDotCom","followers_url":"https://api.github.com/users/DealerDotCom/followers","following_url":"https://api.github.com/users/DealerDotCom/following{/other_user}","gists_url":"https://api.github.com/users/DealerDotCom/gists{/gist_id}","starred_url":"https://api.github.com/users/DealerDotCom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DealerDotCom/subscriptions","organizations_url":"https://api.github.com/users/DealerDotCom/orgs","repos_url":"https://api.github.com/users/DealerDotCom/repos","events_url":"https://api.github.com/users/DealerDotCom/events{/privacy}","received_events_url":"https://api.github.com/users/DealerDotCom/received_events","type":"Organization","site_admin":false},"repo":{"id":69571818,"name":"zipkin-aws","full_name":"DealerDotCom/zipkin-aws","owner":{"login":"DealerDotCom","id":1919423,"avatar_url":"https://avatars.githubusercontent.com/u/1919423?v=3","gravatar_id":"","url":"https://api.github.com/users/DealerDotCom","html_url":"https://github.com/DealerDotCom","followers_url":"https://api.github.com/users/DealerDotCom/followers","following_url":"https://api.github.com/users/DealerDotCom/following{/other_user}","gists_url":"https://api.github.com/users/DealerDotCom/gists{/gist_id}","starred_url":"https://api.github.com/users/DealerDotCom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DealerDotCom/subscriptions","organizations_url":"https://api.github.com/users/DealerDotCom/orgs","repos_url":"https://api.github.com/users/DealerDotCom/repos","events_url":"https://api.github.com/users/DealerDotCom/events{/privacy}","received_events_url":"https://api.github.com/users/DealerDotCom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DealerDotCom/zipkin-aws","description":"Reporters and collectors for use in Amazon's cloud","fork":true,"url":"https://api.github.com/repos/DealerDotCom/zipkin-aws","forks_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/forks","keys_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/teams","hooks_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/hooks","issue_events_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/issues/events{/number}","events_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/events","assignees_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/assignees{/user}","branches_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/branches{/branch}","tags_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/tags","blobs_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/languages","stargazers_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/stargazers","contributors_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/contributors","subscribers_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/subscribers","subscription_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/subscription","commits_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/contents/{+path}","compare_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/merges","archive_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/downloads","issues_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/issues{/number}","pulls_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/labels{/name}","releases_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/releases{/id}","deployments_url":"https://api.github.com/repos/DealerDotCom/zipkin-aws/deployments","created_at":"2016-09-29T13:47:43Z","updated_at":"2016-09-29T20:09:04Z","pushed_at":"2016-09-30T16:06:21Z","git_url":"git://github.com/DealerDotCom/zipkin-aws.git","ssh_url":"git@github.com:DealerDotCom/zipkin-aws.git","clone_url":"https://github.com/DealerDotCom/zipkin-aws.git","svn_url":"https://github.com/DealerDotCom/zipkin-aws","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"language":"Shell","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":"openzipkin:master","ref":"master","sha":"f92c732b264a52a7fa1db6ffc733a1b8e8839e15","user":{"login":"openzipkin","id":11860887,"avatar_url":"https://avatars.githubusercontent.com/u/11860887?v=3","gravatar_id":"","url":"https://api.github.com/users/openzipkin","html_url":"https://github.com/openzipkin","followers_url":"https://api.github.com/users/openzipkin/followers","following_url":"https://api.github.com/users/openzipkin/following{/other_user}","gists_url":"https://api.github.com/users/openzipkin/gists{/gist_id}","starred_url":"https://api.github.com/users/openzipkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openzipkin/subscriptions","organizations_url":"https://api.github.com/users/openzipkin/orgs","repos_url":"https://api.github.com/users/openzipkin/repos","events_url":"https://api.github.com/users/openzipkin/events{/privacy}","received_events_url":"https://api.github.com/users/openzipkin/received_events","type":"Organization","site_admin":false},"repo":{"id":69571507,"name":"zipkin-aws","full_name":"openzipkin/zipkin-aws","owner":{"login":"openzipkin","id":11860887,"avatar_url":"https://avatars.githubusercontent.com/u/11860887?v=3","gravatar_id":"","url":"https://api.github.com/users/openzipkin","html_url":"https://github.com/openzipkin","followers_url":"https://api.github.com/users/openzipkin/followers","following_url":"https://api.github.com/users/openzipkin/following{/other_user}","gists_url":"https://api.github.com/users/openzipkin/gists{/gist_id}","starred_url":"https://api.github.com/users/openzipkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openzipkin/subscriptions","organizations_url":"https://api.github.com/users/openzipkin/orgs","repos_url":"https://api.github.com/users/openzipkin/repos","events_url":"https://api.github.com/users/openzipkin/events{/privacy}","received_events_url":"https://api.github.com/users/openzipkin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openzipkin/zipkin-aws","description":"Reporters and collectors for use in Amazon's cloud","fork":false,"url":"https://api.github.com/repos/openzipkin/zipkin-aws","forks_url":"https://api.github.com/repos/openzipkin/zipkin-aws/forks","keys_url":"https://api.github.com/repos/openzipkin/zipkin-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openzipkin/zipkin-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openzipkin/zipkin-aws/teams","hooks_url":"https://api.github.com/repos/openzipkin/zipkin-aws/hooks","issue_events_url":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/events{/number}","events_url":"https://api.github.com/repos/openzipkin/zipkin-aws/events","assignees_url":"https://api.github.com/repos/openzipkin/zipkin-aws/assignees{/user}","branches_url":"https://api.github.com/repos/openzipkin/zipkin-aws/branches{/branch}","tags_url":"https://api.github.com/repos/openzipkin/zipkin-aws/tags","blobs_url":"https://api.github.com/repos/openzipkin/zipkin-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openzipkin/zipkin-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openzipkin/zipkin-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/openzipkin/zipkin-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openzipkin/zipkin-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/openzipkin/zipkin-aws/languages","stargazers_url":"https://api.github.com/repos/openzipkin/zipkin-aws/stargazers","contributors_url":"https://api.github.com/repos/openzipkin/zipkin-aws/contributors","subscribers_url":"https://api.github.com/repos/openzipkin/zipkin-aws/subscribers","subscription_url":"https://api.github.com/repos/openzipkin/zipkin-aws/subscription","commits_url":"https://api.github.com/repos/openzipkin/zipkin-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/openzipkin/zipkin-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/openzipkin/zipkin-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/openzipkin/zipkin-aws/contents/{+path}","compare_url":"https://api.github.com/repos/openzipkin/zipkin-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openzipkin/zipkin-aws/merges","archive_url":"https://api.github.com/repos/openzipkin/zipkin-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openzipkin/zipkin-aws/downloads","issues_url":"https://api.github.com/repos/openzipkin/zipkin-aws/issues{/number}","pulls_url":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/openzipkin/zipkin-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/openzipkin/zipkin-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openzipkin/zipkin-aws/labels{/name}","releases_url":"https://api.github.com/repos/openzipkin/zipkin-aws/releases{/id}","deployments_url":"https://api.github.com/repos/openzipkin/zipkin-aws/deployments","created_at":"2016-09-29T13:44:26Z","updated_at":"2016-10-01T03:11:39Z","pushed_at":"2016-10-03T23:53:51Z","git_url":"git://github.com/openzipkin/zipkin-aws.git","ssh_url":"git@github.com:openzipkin/zipkin-aws.git","clone_url":"https://github.com/openzipkin/zipkin-aws.git","svn_url":"https://github.com/openzipkin/zipkin-aws","homepage":null,"size":12,"stargazers_count":1,"watchers_count":1,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6"},"html":{"href":"https://github.com/openzipkin/zipkin-aws/pull/6"},"issue":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/6"},"comments":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/openzipkin/zipkin-aws/statuses/caf6d640721d6fc530ab34a1187dd7b93a9c72bb"}}}}
{"actor":{"display_login":"llinder"}}