{"action":"created","comment":{"url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/comments/46218690","id":46218690,"diff_hunk":"@@ -0,0 +1,206 @@\n+package com.salesforce.spark.carrot\n+\n+import java.net.ConnectException\n+\n+import com.rabbitmq.client._\n+import org.apache.spark.Logging\n+import org.apache.spark.storage.StorageLevel\n+import org.apache.spark.streaming.StreamingContext\n+import org.apache.spark.streaming.dstream._\n+import org.apache.spark.streaming.receiver.Receiver\n+\n+import scala.collection.mutable.ArrayBuffer\n+import scala.reflect.{ClassTag, classTag}\n+import scala.util.Try\n+\n+/**\n+ * Created by suryasev on 4/28/15.\n+ *\n+ * Modeled upon org.apache.spark.streaming.kafka.KafkaUtils\n+ */\n+object RabbitUtils {\n+  /**\n+   * Create an input stream that pulls messages from Rabbit MQ.\n+   * @param ssc         StreamingContext object\n+   * @param rmqConfig   RMQConfig object containing RabbitMQ specific configurations\n+   * @param storageLevel Storage level to use for storing the received objects\n+   */\n+  def createStream[T: ClassTag, U <: Decoder[_] : ClassTag]\n+  (\n+    ssc: StreamingContext,\n+    rmqConfig: RMQConfig,\n+    storageLevel: StorageLevel = StorageLevel.MEMORY_AND_DISK_SER_2\n+    ): ReceiverInputDStream[T] = new RMQInputDStream[T, U](ssc, rmqConfig, storageLevel)\n+}\n+\n+/**\n+ * Create an input stream that pulls messages from Rabbit MQ.\n+ * @param ssc_         StreamingContext object\n+ * @param rmqConfig   RMQConfig object containing RabbitMQ specific configurations\n+ * @param storageLevel Storage level to use for storing the received objects\n+ */\n+class RMQInputDStream[T: ClassTag, U <: Decoder[_] : ClassTag]","path":"src/main/scala/com/salesforce/spark/carrot/RabbitUtils.scala","position":42,"original_position":42,"commit_id":"e777b1a9a48c0f59b07dd8b377ce77dc90b82b4b","original_commit_id":"e777b1a9a48c0f59b07dd8b377ce77dc90b82b4b","user":{"login":"tovbinm","id":629845,"avatar_url":"https://avatars.githubusercontent.com/u/629845?v=3","gravatar_id":"","url":"https://api.github.com/users/tovbinm","html_url":"https://github.com/tovbinm","followers_url":"https://api.github.com/users/tovbinm/followers","following_url":"https://api.github.com/users/tovbinm/following{/other_user}","gists_url":"https://api.github.com/users/tovbinm/gists{/gist_id}","starred_url":"https://api.github.com/users/tovbinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tovbinm/subscriptions","organizations_url":"https://api.github.com/users/tovbinm/orgs","repos_url":"https://api.github.com/users/tovbinm/repos","events_url":"https://api.github.com/users/tovbinm/events{/privacy}","received_events_url":"https://api.github.com/users/tovbinm/received_events","type":"User","site_admin":false},"body":"@suryasev put `RMQInputDStream` in a separate file","created_at":"2015-11-30T23:12:30Z","updated_at":"2015-11-30T23:12:30Z","html_url":"https://github.com/suryasev/SparkCarrot/pull/1#discussion_r46218690","pull_request_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/comments/46218690"},"html":{"href":"https://github.com/suryasev/SparkCarrot/pull/1#discussion_r46218690"},"pull_request":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1","id":48401565,"html_url":"https://github.com/suryasev/SparkCarrot/pull/1","diff_url":"https://github.com/suryasev/SparkCarrot/pull/1.diff","patch_url":"https://github.com/suryasev/SparkCarrot/pull/1.patch","issue_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/1","number":1,"state":"open","locked":false,"title":"Init commit","user":{"login":"suryasev","id":50299,"avatar_url":"https://avatars.githubusercontent.com/u/50299?v=3","gravatar_id":"","url":"https://api.github.com/users/suryasev","html_url":"https://github.com/suryasev","followers_url":"https://api.github.com/users/suryasev/followers","following_url":"https://api.github.com/users/suryasev/following{/other_user}","gists_url":"https://api.github.com/users/suryasev/gists{/gist_id}","starred_url":"https://api.github.com/users/suryasev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryasev/subscriptions","organizations_url":"https://api.github.com/users/suryasev/orgs","repos_url":"https://api.github.com/users/suryasev/repos","events_url":"https://api.github.com/users/suryasev/events{/privacy}","received_events_url":"https://api.github.com/users/suryasev/received_events","type":"User","site_admin":false},"body":"First breakout of SparkCarrot into its own library.  This initial commit is still a WIP, but I welcome any feedback as early as possible.\r\n\r\nKnown todos:\r\nMore testing\r\nBreak Avro portion out into a separate repo\r\nBetter examples\r\n\r\nNote that this is a public externally-visible repository.","created_at":"2015-10-21T23:31:23Z","updated_at":"2015-11-30T23:12:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffef2ff2b25ad56ed0c2bbc22f30e5676bf3ed11","assignee":{"login":"tovbinm","id":629845,"avatar_url":"https://avatars.githubusercontent.com/u/629845?v=3","gravatar_id":"","url":"https://api.github.com/users/tovbinm","html_url":"https://github.com/tovbinm","followers_url":"https://api.github.com/users/tovbinm/followers","following_url":"https://api.github.com/users/tovbinm/following{/other_user}","gists_url":"https://api.github.com/users/tovbinm/gists{/gist_id}","starred_url":"https://api.github.com/users/tovbinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tovbinm/subscriptions","organizations_url":"https://api.github.com/users/tovbinm/orgs","repos_url":"https://api.github.com/users/tovbinm/repos","events_url":"https://api.github.com/users/tovbinm/events{/privacy}","received_events_url":"https://api.github.com/users/tovbinm/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1/commits","review_comments_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1/comments","review_comment_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/1/comments","statuses_url":"https://api.github.com/repos/suryasev/SparkCarrot/statuses/e777b1a9a48c0f59b07dd8b377ce77dc90b82b4b","head":{"label":"suryasev:initCommit","ref":"initCommit","sha":"e777b1a9a48c0f59b07dd8b377ce77dc90b82b4b","user":{"login":"suryasev","id":50299,"avatar_url":"https://avatars.githubusercontent.com/u/50299?v=3","gravatar_id":"","url":"https://api.github.com/users/suryasev","html_url":"https://github.com/suryasev","followers_url":"https://api.github.com/users/suryasev/followers","following_url":"https://api.github.com/users/suryasev/following{/other_user}","gists_url":"https://api.github.com/users/suryasev/gists{/gist_id}","starred_url":"https://api.github.com/users/suryasev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryasev/subscriptions","organizations_url":"https://api.github.com/users/suryasev/orgs","repos_url":"https://api.github.com/users/suryasev/repos","events_url":"https://api.github.com/users/suryasev/events{/privacy}","received_events_url":"https://api.github.com/users/suryasev/received_events","type":"User","site_admin":false},"repo":{"id":44707229,"name":"SparkCarrot","full_name":"suryasev/SparkCarrot","owner":{"login":"suryasev","id":50299,"avatar_url":"https://avatars.githubusercontent.com/u/50299?v=3","gravatar_id":"","url":"https://api.github.com/users/suryasev","html_url":"https://github.com/suryasev","followers_url":"https://api.github.com/users/suryasev/followers","following_url":"https://api.github.com/users/suryasev/following{/other_user}","gists_url":"https://api.github.com/users/suryasev/gists{/gist_id}","starred_url":"https://api.github.com/users/suryasev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryasev/subscriptions","organizations_url":"https://api.github.com/users/suryasev/orgs","repos_url":"https://api.github.com/users/suryasev/repos","events_url":"https://api.github.com/users/suryasev/events{/privacy}","received_events_url":"https://api.github.com/users/suryasev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suryasev/SparkCarrot","description":"RabbitMQ receiver for a Spark implemented in same way as Spark KafkaUtils","fork":false,"url":"https://api.github.com/repos/suryasev/SparkCarrot","forks_url":"https://api.github.com/repos/suryasev/SparkCarrot/forks","keys_url":"https://api.github.com/repos/suryasev/SparkCarrot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suryasev/SparkCarrot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suryasev/SparkCarrot/teams","hooks_url":"https://api.github.com/repos/suryasev/SparkCarrot/hooks","issue_events_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/events{/number}","events_url":"https://api.github.com/repos/suryasev/SparkCarrot/events","assignees_url":"https://api.github.com/repos/suryasev/SparkCarrot/assignees{/user}","branches_url":"https://api.github.com/repos/suryasev/SparkCarrot/branches{/branch}","tags_url":"https://api.github.com/repos/suryasev/SparkCarrot/tags","blobs_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/refs{/sha}","trees_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suryasev/SparkCarrot/statuses/{sha}","languages_url":"https://api.github.com/repos/suryasev/SparkCarrot/languages","stargazers_url":"https://api.github.com/repos/suryasev/SparkCarrot/stargazers","contributors_url":"https://api.github.com/repos/suryasev/SparkCarrot/contributors","subscribers_url":"https://api.github.com/repos/suryasev/SparkCarrot/subscribers","subscription_url":"https://api.github.com/repos/suryasev/SparkCarrot/subscription","commits_url":"https://api.github.com/repos/suryasev/SparkCarrot/commits{/sha}","git_commits_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/commits{/sha}","comments_url":"https://api.github.com/repos/suryasev/SparkCarrot/comments{/number}","issue_comment_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/comments{/number}","contents_url":"https://api.github.com/repos/suryasev/SparkCarrot/contents/{+path}","compare_url":"https://api.github.com/repos/suryasev/SparkCarrot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suryasev/SparkCarrot/merges","archive_url":"https://api.github.com/repos/suryasev/SparkCarrot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suryasev/SparkCarrot/downloads","issues_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues{/number}","pulls_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls{/number}","milestones_url":"https://api.github.com/repos/suryasev/SparkCarrot/milestones{/number}","notifications_url":"https://api.github.com/repos/suryasev/SparkCarrot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suryasev/SparkCarrot/labels{/name}","releases_url":"https://api.github.com/repos/suryasev/SparkCarrot/releases{/id}","created_at":"2015-10-21T22:05:23Z","updated_at":"2015-10-21T22:05:23Z","pushed_at":"2015-10-21T23:47:56Z","git_url":"git://github.com/suryasev/SparkCarrot.git","ssh_url":"git@github.com:suryasev/SparkCarrot.git","clone_url":"https://github.com/suryasev/SparkCarrot.git","svn_url":"https://github.com/suryasev/SparkCarrot","homepage":null,"size":156,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"suryasev:master","ref":"master","sha":"78355fc231094842b9576ac61da1f12ed028df1d","user":{"login":"suryasev","id":50299,"avatar_url":"https://avatars.githubusercontent.com/u/50299?v=3","gravatar_id":"","url":"https://api.github.com/users/suryasev","html_url":"https://github.com/suryasev","followers_url":"https://api.github.com/users/suryasev/followers","following_url":"https://api.github.com/users/suryasev/following{/other_user}","gists_url":"https://api.github.com/users/suryasev/gists{/gist_id}","starred_url":"https://api.github.com/users/suryasev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryasev/subscriptions","organizations_url":"https://api.github.com/users/suryasev/orgs","repos_url":"https://api.github.com/users/suryasev/repos","events_url":"https://api.github.com/users/suryasev/events{/privacy}","received_events_url":"https://api.github.com/users/suryasev/received_events","type":"User","site_admin":false},"repo":{"id":44707229,"name":"SparkCarrot","full_name":"suryasev/SparkCarrot","owner":{"login":"suryasev","id":50299,"avatar_url":"https://avatars.githubusercontent.com/u/50299?v=3","gravatar_id":"","url":"https://api.github.com/users/suryasev","html_url":"https://github.com/suryasev","followers_url":"https://api.github.com/users/suryasev/followers","following_url":"https://api.github.com/users/suryasev/following{/other_user}","gists_url":"https://api.github.com/users/suryasev/gists{/gist_id}","starred_url":"https://api.github.com/users/suryasev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suryasev/subscriptions","organizations_url":"https://api.github.com/users/suryasev/orgs","repos_url":"https://api.github.com/users/suryasev/repos","events_url":"https://api.github.com/users/suryasev/events{/privacy}","received_events_url":"https://api.github.com/users/suryasev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suryasev/SparkCarrot","description":"RabbitMQ receiver for a Spark implemented in same way as Spark KafkaUtils","fork":false,"url":"https://api.github.com/repos/suryasev/SparkCarrot","forks_url":"https://api.github.com/repos/suryasev/SparkCarrot/forks","keys_url":"https://api.github.com/repos/suryasev/SparkCarrot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suryasev/SparkCarrot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suryasev/SparkCarrot/teams","hooks_url":"https://api.github.com/repos/suryasev/SparkCarrot/hooks","issue_events_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/events{/number}","events_url":"https://api.github.com/repos/suryasev/SparkCarrot/events","assignees_url":"https://api.github.com/repos/suryasev/SparkCarrot/assignees{/user}","branches_url":"https://api.github.com/repos/suryasev/SparkCarrot/branches{/branch}","tags_url":"https://api.github.com/repos/suryasev/SparkCarrot/tags","blobs_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/refs{/sha}","trees_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suryasev/SparkCarrot/statuses/{sha}","languages_url":"https://api.github.com/repos/suryasev/SparkCarrot/languages","stargazers_url":"https://api.github.com/repos/suryasev/SparkCarrot/stargazers","contributors_url":"https://api.github.com/repos/suryasev/SparkCarrot/contributors","subscribers_url":"https://api.github.com/repos/suryasev/SparkCarrot/subscribers","subscription_url":"https://api.github.com/repos/suryasev/SparkCarrot/subscription","commits_url":"https://api.github.com/repos/suryasev/SparkCarrot/commits{/sha}","git_commits_url":"https://api.github.com/repos/suryasev/SparkCarrot/git/commits{/sha}","comments_url":"https://api.github.com/repos/suryasev/SparkCarrot/comments{/number}","issue_comment_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues/comments{/number}","contents_url":"https://api.github.com/repos/suryasev/SparkCarrot/contents/{+path}","compare_url":"https://api.github.com/repos/suryasev/SparkCarrot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suryasev/SparkCarrot/merges","archive_url":"https://api.github.com/repos/suryasev/SparkCarrot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suryasev/SparkCarrot/downloads","issues_url":"https://api.github.com/repos/suryasev/SparkCarrot/issues{/number}","pulls_url":"https://api.github.com/repos/suryasev/SparkCarrot/pulls{/number}","milestones_url":"https://api.github.com/repos/suryasev/SparkCarrot/milestones{/number}","notifications_url":"https://api.github.com/repos/suryasev/SparkCarrot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suryasev/SparkCarrot/labels{/name}","releases_url":"https://api.github.com/repos/suryasev/SparkCarrot/releases{/id}","created_at":"2015-10-21T22:05:23Z","updated_at":"2015-10-21T22:05:23Z","pushed_at":"2015-10-21T23:47:56Z","git_url":"git://github.com/suryasev/SparkCarrot.git","ssh_url":"git@github.com:suryasev/SparkCarrot.git","clone_url":"https://github.com/suryasev/SparkCarrot.git","svn_url":"https://github.com/suryasev/SparkCarrot","homepage":null,"size":156,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1"},"html":{"href":"https://github.com/suryasev/SparkCarrot/pull/1"},"issue":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/issues/1"},"comments":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/suryasev/SparkCarrot/statuses/e777b1a9a48c0f59b07dd8b377ce77dc90b82b4b"}}}}