{"action":"created","comment":{"url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/comments/31546412","id":31546412,"diff_hunk":"@@ -0,0 +1,54 @@\n+package org.atlasapi.persistence.content;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+import java.math.BigInteger;\n+import java.util.UUID;\n+\n+import org.atlasapi.media.entity.ContentGroup;\n+import org.atlasapi.messaging.v3.EntityUpdatedMessage;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import com.metabroadcast.common.ids.SubstitutionTableNumberCodec;\n+import com.metabroadcast.common.queue.MessageSender;\n+import com.metabroadcast.common.queue.MessagingException;\n+import com.metabroadcast.common.time.Timestamper;\n+\n+public class MessageQueuingContentGroupWriter implements ContentGroupWriter {\n+\n+    private static final Logger log = LoggerFactory.getLogger(MessageQueuingContentGroupWriter.class);\n+\n+    private final SubstitutionTableNumberCodec entityIdCodec = SubstitutionTableNumberCodec.lowerCaseOnly();\n+\n+    private final ContentGroupWriter delegate;\n+    private final MessageSender<EntityUpdatedMessage> messageSender;\n+    private final Timestamper clock;\n+\n+    public MessageQueuingContentGroupWriter(ContentGroupWriter delegate,\n+            MessageSender<EntityUpdatedMessage> messageSender, Timestamper clock) {\n+        this.delegate = checkNotNull(delegate);\n+        this.messageSender = checkNotNull(messageSender);\n+        this.clock = checkNotNull(clock);\n+    }\n+\n+    @Override\n+    public void createOrUpdate(ContentGroup group) {\n+        try {\n+            delegate.createOrUpdate(group);\n+            messageSender.sendMessage(createEntityUpdatedMessage(group));\n+        } catch (MessagingException e) {\n+            log.error(\"update message failed: \" + group.toString(), e);\n+        }\n+    }\n+\n+    private EntityUpdatedMessage createEntityUpdatedMessage(ContentGroup content) {","path":"src/main/java/org/atlasapi/persistence/content/MessageQueuingContentGroupWriter.java","position":45,"original_position":45,"commit_id":"3b687eb1190189f544995a3c680bfe691ff7b9e6","original_commit_id":"3b687eb1190189f544995a3c680bfe691ff7b9e6","user":{"login":"tfm","id":747291,"avatar_url":"https://avatars.githubusercontent.com/u/747291?v=3","gravatar_id":"","url":"https://api.github.com/users/tfm","html_url":"https://github.com/tfm","followers_url":"https://api.github.com/users/tfm/followers","following_url":"https://api.github.com/users/tfm/following{/other_user}","gists_url":"https://api.github.com/users/tfm/gists{/gist_id}","starred_url":"https://api.github.com/users/tfm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfm/subscriptions","organizations_url":"https://api.github.com/users/tfm/orgs","repos_url":"https://api.github.com/users/tfm/repos","events_url":"https://api.github.com/users/tfm/events{/privacy}","received_events_url":"https://api.github.com/users/tfm/received_events","type":"User","site_admin":false},"body":"`contentGroup` rather than `content`?","created_at":"2015-06-02T17:13:42Z","updated_at":"2015-06-02T17:13:42Z","html_url":"https://github.com/atlasapi/atlas-persistence/pull/201#discussion_r31546412","pull_request_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201","_links":{"self":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/comments/31546412"},"html":{"href":"https://github.com/atlasapi/atlas-persistence/pull/201#discussion_r31546412"},"pull_request":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201"}}},"pull_request":{"url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201","id":36734244,"html_url":"https://github.com/atlasapi/atlas-persistence/pull/201","diff_url":"https://github.com/atlasapi/atlas-persistence/pull/201.diff","patch_url":"https://github.com/atlasapi/atlas-persistence/pull/201.patch","issue_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/201","number":201,"state":"open","locked":false,"title":"Content Group changes should queue update messages to Atlas Deer","user":{"login":"mbst-jamie","id":8318871,"avatar_url":"https://avatars.githubusercontent.com/u/8318871?v=3","gravatar_id":"","url":"https://api.github.com/users/mbst-jamie","html_url":"https://github.com/mbst-jamie","followers_url":"https://api.github.com/users/mbst-jamie/followers","following_url":"https://api.github.com/users/mbst-jamie/following{/other_user}","gists_url":"https://api.github.com/users/mbst-jamie/gists{/gist_id}","starred_url":"https://api.github.com/users/mbst-jamie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbst-jamie/subscriptions","organizations_url":"https://api.github.com/users/mbst-jamie/orgs","repos_url":"https://api.github.com/users/mbst-jamie/repos","events_url":"https://api.github.com/users/mbst-jamie/events{/privacy}","received_events_url":"https://api.github.com/users/mbst-jamie/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-02T14:27:56Z","updated_at":"2015-06-02T17:13:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"631f7174563cbca0966bea85e008c9a1bd64a40f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201/commits","review_comments_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201/comments","review_comment_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/201/comments","statuses_url":"https://api.github.com/repos/atlasapi/atlas-persistence/statuses/3b687eb1190189f544995a3c680bfe691ff7b9e6","head":{"label":"atlasapi:content-group-update-messaging","ref":"content-group-update-messaging","sha":"3b687eb1190189f544995a3c680bfe691ff7b9e6","user":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"repo":{"id":762122,"name":"atlas-persistence","full_name":"atlasapi/atlas-persistence","owner":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlasapi/atlas-persistence","description":"","fork":false,"url":"https://api.github.com/repos/atlasapi/atlas-persistence","forks_url":"https://api.github.com/repos/atlasapi/atlas-persistence/forks","keys_url":"https://api.github.com/repos/atlasapi/atlas-persistence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlasapi/atlas-persistence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlasapi/atlas-persistence/teams","hooks_url":"https://api.github.com/repos/atlasapi/atlas-persistence/hooks","issue_events_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/events{/number}","events_url":"https://api.github.com/repos/atlasapi/atlas-persistence/events","assignees_url":"https://api.github.com/repos/atlasapi/atlas-persistence/assignees{/user}","branches_url":"https://api.github.com/repos/atlasapi/atlas-persistence/branches{/branch}","tags_url":"https://api.github.com/repos/atlasapi/atlas-persistence/tags","blobs_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlasapi/atlas-persistence/statuses/{sha}","languages_url":"https://api.github.com/repos/atlasapi/atlas-persistence/languages","stargazers_url":"https://api.github.com/repos/atlasapi/atlas-persistence/stargazers","contributors_url":"https://api.github.com/repos/atlasapi/atlas-persistence/contributors","subscribers_url":"https://api.github.com/repos/atlasapi/atlas-persistence/subscribers","subscription_url":"https://api.github.com/repos/atlasapi/atlas-persistence/subscription","commits_url":"https://api.github.com/repos/atlasapi/atlas-persistence/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlasapi/atlas-persistence/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlasapi/atlas-persistence/contents/{+path}","compare_url":"https://api.github.com/repos/atlasapi/atlas-persistence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlasapi/atlas-persistence/merges","archive_url":"https://api.github.com/repos/atlasapi/atlas-persistence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlasapi/atlas-persistence/downloads","issues_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues{/number}","pulls_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls{/number}","milestones_url":"https://api.github.com/repos/atlasapi/atlas-persistence/milestones{/number}","notifications_url":"https://api.github.com/repos/atlasapi/atlas-persistence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlasapi/atlas-persistence/labels{/name}","releases_url":"https://api.github.com/repos/atlasapi/atlas-persistence/releases{/id}","created_at":"2010-07-07T16:30:16Z","updated_at":"2015-04-20T10:11:10Z","pushed_at":"2015-06-02T16:32:05Z","git_url":"git://github.com/atlasapi/atlas-persistence.git","ssh_url":"git@github.com:atlasapi/atlas-persistence.git","clone_url":"https://github.com/atlasapi/atlas-persistence.git","svn_url":"https://github.com/atlasapi/atlas-persistence","homepage":"docs.atlasapi.org","size":6547,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":2,"default_branch":"master"}},"base":{"label":"atlasapi:master","ref":"master","sha":"b34418d38ad63a18afb18c7554bd49dc7587a0ee","user":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"repo":{"id":762122,"name":"atlas-persistence","full_name":"atlasapi/atlas-persistence","owner":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlasapi/atlas-persistence","description":"","fork":false,"url":"https://api.github.com/repos/atlasapi/atlas-persistence","forks_url":"https://api.github.com/repos/atlasapi/atlas-persistence/forks","keys_url":"https://api.github.com/repos/atlasapi/atlas-persistence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlasapi/atlas-persistence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlasapi/atlas-persistence/teams","hooks_url":"https://api.github.com/repos/atlasapi/atlas-persistence/hooks","issue_events_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/events{/number}","events_url":"https://api.github.com/repos/atlasapi/atlas-persistence/events","assignees_url":"https://api.github.com/repos/atlasapi/atlas-persistence/assignees{/user}","branches_url":"https://api.github.com/repos/atlasapi/atlas-persistence/branches{/branch}","tags_url":"https://api.github.com/repos/atlasapi/atlas-persistence/tags","blobs_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlasapi/atlas-persistence/statuses/{sha}","languages_url":"https://api.github.com/repos/atlasapi/atlas-persistence/languages","stargazers_url":"https://api.github.com/repos/atlasapi/atlas-persistence/stargazers","contributors_url":"https://api.github.com/repos/atlasapi/atlas-persistence/contributors","subscribers_url":"https://api.github.com/repos/atlasapi/atlas-persistence/subscribers","subscription_url":"https://api.github.com/repos/atlasapi/atlas-persistence/subscription","commits_url":"https://api.github.com/repos/atlasapi/atlas-persistence/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlasapi/atlas-persistence/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlasapi/atlas-persistence/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlasapi/atlas-persistence/contents/{+path}","compare_url":"https://api.github.com/repos/atlasapi/atlas-persistence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlasapi/atlas-persistence/merges","archive_url":"https://api.github.com/repos/atlasapi/atlas-persistence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlasapi/atlas-persistence/downloads","issues_url":"https://api.github.com/repos/atlasapi/atlas-persistence/issues{/number}","pulls_url":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls{/number}","milestones_url":"https://api.github.com/repos/atlasapi/atlas-persistence/milestones{/number}","notifications_url":"https://api.github.com/repos/atlasapi/atlas-persistence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlasapi/atlas-persistence/labels{/name}","releases_url":"https://api.github.com/repos/atlasapi/atlas-persistence/releases{/id}","created_at":"2010-07-07T16:30:16Z","updated_at":"2015-04-20T10:11:10Z","pushed_at":"2015-06-02T16:32:05Z","git_url":"git://github.com/atlasapi/atlas-persistence.git","ssh_url":"git@github.com:atlasapi/atlas-persistence.git","clone_url":"https://github.com/atlasapi/atlas-persistence.git","svn_url":"https://github.com/atlasapi/atlas-persistence","homepage":"docs.atlasapi.org","size":6547,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201"},"html":{"href":"https://github.com/atlasapi/atlas-persistence/pull/201"},"issue":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/201"},"comments":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/issues/201/comments"},"review_comments":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201/comments"},"review_comment":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/pulls/201/commits"},"statuses":{"href":"https://api.github.com/repos/atlasapi/atlas-persistence/statuses/3b687eb1190189f544995a3c680bfe691ff7b9e6"}}}}