{"action":"created","comment":{"url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments/32950296","id":32950296,"diff_hunk":"@@ -38,6 +54,14 @@\n       (lq/declare delete-ch\n                   \"electorate-works.electorate.delete\"\n                   (config :rabbitmq :queues \"electorate-works.delete\"))\n+\n+      (lq/declare election-search-ch\n+                  \"election-works.election.search\"\n+                  (config :rabbitmq :queues \"election-works.election.search\"))\n+      (lq/declare election-authority-search-ch\n+                  \"election-authority-works.search\"\n+                  (config :rabbitmq :queues \"election-authority-works.search\"))","path":"src/electorate_works/queue.clj","position":38,"original_position":38,"commit_id":"19caa4398188abeffe4e942656f424ec48f310d2","original_commit_id":"19caa4398188abeffe4e942656f424ec48f310d2","user":{"login":"tank157","id":4147,"avatar_url":"https://avatars.githubusercontent.com/u/4147?v=3","gravatar_id":"","url":"https://api.github.com/users/tank157","html_url":"https://github.com/tank157","followers_url":"https://api.github.com/users/tank157/followers","following_url":"https://api.github.com/users/tank157/following{/other_user}","gists_url":"https://api.github.com/users/tank157/gists{/gist_id}","starred_url":"https://api.github.com/users/tank157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tank157/subscriptions","organizations_url":"https://api.github.com/users/tank157/orgs","repos_url":"https://api.github.com/users/tank157/repos","events_url":"https://api.github.com/users/tank157/events{/privacy}","received_events_url":"https://api.github.com/users/tank157/received_events","type":"User","site_admin":false},"body":"Also, I noted this because I'm working on the `election.create`, but the config has neither `election-authority-works.search` nor `election-works.election.search` in it currently.","created_at":"2015-06-22T15:56:39Z","updated_at":"2015-06-22T15:56:39Z","html_url":"https://github.com/democracyworks/electorate-works/pull/2#discussion_r32950296","pull_request_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments/32950296"},"html":{"href":"https://github.com/democracyworks/electorate-works/pull/2#discussion_r32950296"},"pull_request":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2","id":38026356,"html_url":"https://github.com/democracyworks/electorate-works/pull/2","diff_url":"https://github.com/democracyworks/electorate-works/pull/2.diff","patch_url":"https://github.com/democracyworks/electorate-works/pull/2.patch","issue_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/2","number":2,"state":"open","locked":false,"title":"User create event","user":{"login":"ericnormand","id":116172,"avatar_url":"https://avatars.githubusercontent.com/u/116172?v=3","gravatar_id":"","url":"https://api.github.com/users/ericnormand","html_url":"https://github.com/ericnormand","followers_url":"https://api.github.com/users/ericnormand/followers","following_url":"https://api.github.com/users/ericnormand/following{/other_user}","gists_url":"https://api.github.com/users/ericnormand/gists{/gist_id}","starred_url":"https://api.github.com/users/ericnormand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericnormand/subscriptions","organizations_url":"https://api.github.com/users/ericnormand/orgs","repos_url":"https://api.github.com/users/ericnormand/repos","events_url":"https://api.github.com/users/ericnormand/events{/privacy}","received_events_url":"https://api.github.com/users/ericnormand/received_events","type":"User","site_admin":false},"body":"[Pivotal Card](https://www.pivotaltracker.com/story/show/95886418)\r\n\r\nWire up electorate.create events onto the events exchange. We did it in the entities.electorate namespace because all electorate creation passes through there. Putting it in the handlers is less certain.\r\n\r\nLots of queue wiring. Please please check this (I'm talking to you @tie-rack).\r\n\r\nUser create event handling needs to look up upcoming elections associated with the users's registered address's ocdids. The elections will have authority-levels. We select the users's ocdids that match the authority levels and search the election-authorities for those ocdids. This gives us the three parts of an electorate (userid, electionid, #{election-authorityid}).\r\n\r\nThe shakiest part is the function `ocd-id-level` which judges the ocd's level using regexes. :municipal is the fallthrough though we know that not all of those falling through are actually municipal. Suggestions for improvements are welcome.\r\n\r\nSeveral things that could be moved into a separate library:\r\n* channels/start-event-handler! (which starts a thread to listen for events)\r\n* handlers/deref-or-timeout (which derefs promises or throws an exception on timeout)\r\n* handlers/handle-errors (it exists already in other projects but this one catches Throwable, which is the superclass of all errors; other versions only catch runtimeexception, which would let AssertionErrors and other Exceptions through).\r\n\r\n","created_at":"2015-06-18T16:31:54Z","updated_at":"2015-06-22T15:56:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a3e3da5359286b3a23eb48dc494b4b4dfde18cb","assignee":{"login":"cap10morgan","id":59748,"avatar_url":"https://avatars.githubusercontent.com/u/59748?v=3","gravatar_id":"","url":"https://api.github.com/users/cap10morgan","html_url":"https://github.com/cap10morgan","followers_url":"https://api.github.com/users/cap10morgan/followers","following_url":"https://api.github.com/users/cap10morgan/following{/other_user}","gists_url":"https://api.github.com/users/cap10morgan/gists{/gist_id}","starred_url":"https://api.github.com/users/cap10morgan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cap10morgan/subscriptions","organizations_url":"https://api.github.com/users/cap10morgan/orgs","repos_url":"https://api.github.com/users/cap10morgan/repos","events_url":"https://api.github.com/users/cap10morgan/events{/privacy}","received_events_url":"https://api.github.com/users/cap10morgan/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2/commits","review_comments_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2/comments","review_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments{/number}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/2/comments","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/19caa4398188abeffe4e942656f424ec48f310d2","head":{"label":"democracyworks:user-create-event","ref":"user-create-event","sha":"19caa4398188abeffe4e942656f424ec48f310d2","user":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"repo":{"id":37331127,"name":"electorate-works","full_name":"democracyworks/electorate-works","owner":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/democracyworks/electorate-works","description":"","fork":false,"url":"https://api.github.com/repos/democracyworks/electorate-works","forks_url":"https://api.github.com/repos/democracyworks/electorate-works/forks","keys_url":"https://api.github.com/repos/democracyworks/electorate-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/electorate-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/electorate-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/electorate-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/electorate-works/events","assignees_url":"https://api.github.com/repos/democracyworks/electorate-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/electorate-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/electorate-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/electorate-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/electorate-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/electorate-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/electorate-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/electorate-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/electorate-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/electorate-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/electorate-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/electorate-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/electorate-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/electorate-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/electorate-works/merges","archive_url":"https://api.github.com/repos/democracyworks/electorate-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/electorate-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/electorate-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/electorate-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/electorate-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/electorate-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/electorate-works/releases{/id}","created_at":"2015-06-12T15:58:32Z","updated_at":"2015-06-12T15:59:57Z","pushed_at":"2015-06-18T16:31:54Z","git_url":"git://github.com/democracyworks/electorate-works.git","ssh_url":"git@github.com:democracyworks/electorate-works.git","clone_url":"https://github.com/democracyworks/electorate-works.git","svn_url":"https://github.com/democracyworks/electorate-works","homepage":null,"size":176,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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":"democracyworks:master","ref":"master","sha":"8114e5fffbe58dd328322ce761f72098e00262dc","user":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"repo":{"id":37331127,"name":"electorate-works","full_name":"democracyworks/electorate-works","owner":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/democracyworks/electorate-works","description":"","fork":false,"url":"https://api.github.com/repos/democracyworks/electorate-works","forks_url":"https://api.github.com/repos/democracyworks/electorate-works/forks","keys_url":"https://api.github.com/repos/democracyworks/electorate-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/electorate-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/electorate-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/electorate-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/electorate-works/events","assignees_url":"https://api.github.com/repos/democracyworks/electorate-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/electorate-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/electorate-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/electorate-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/electorate-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/electorate-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/electorate-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/electorate-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/electorate-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/electorate-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/electorate-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/electorate-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/electorate-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/electorate-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/electorate-works/merges","archive_url":"https://api.github.com/repos/democracyworks/electorate-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/electorate-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/electorate-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/electorate-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/electorate-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/electorate-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/electorate-works/releases{/id}","created_at":"2015-06-12T15:58:32Z","updated_at":"2015-06-12T15:59:57Z","pushed_at":"2015-06-18T16:31:54Z","git_url":"git://github.com/democracyworks/electorate-works.git","ssh_url":"git@github.com:democracyworks/electorate-works.git","clone_url":"https://github.com/democracyworks/electorate-works.git","svn_url":"https://github.com/democracyworks/electorate-works","homepage":null,"size":176,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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/democracyworks/electorate-works/pulls/2"},"html":{"href":"https://github.com/democracyworks/electorate-works/pull/2"},"issue":{"href":"https://api.github.com/repos/democracyworks/electorate-works/issues/2"},"comments":{"href":"https://api.github.com/repos/democracyworks/electorate-works/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/democracyworks/electorate-works/statuses/19caa4398188abeffe4e942656f424ec48f310d2"}}}}