{"action":"created","comment":{"url":"https://api.github.com/repos/libgraviton/graviton/pulls/comments/39022550","id":39022550,"diff_hunk":"@@ -0,0 +1,38 @@\n+<?php\n+/**\n+ * core infrastructure like logging and framework.\n+ */\n+\n+namespace Graviton\\RabbitMqBundle;\n+\n+use Graviton\\BundleBundle\\GravitonBundleInterface;\n+use Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n+use Symfony\\Component\\HttpKernel\\Bundle\\Bundle;\n+\n+/**\n+ * GravitonCoreBundle\n+ *\n+ * WARNING: Don't change me without changing Graviton\\GeneratorBundle\\Manipulator\\BundleBundleManipulator","path":"src/Graviton/RabbitMqBundle/GravitonRabbitMqBundle.php","position":15,"original_position":15,"commit_id":"417333eb168733facd494e43d2a6805e699dc053","original_commit_id":"417333eb168733facd494e43d2a6805e699dc053","user":{"login":"hairmare","id":116588,"avatar_url":"https://avatars.githubusercontent.com/u/116588?v=3","gravatar_id":"","url":"https://api.github.com/users/hairmare","html_url":"https://github.com/hairmare","followers_url":"https://api.github.com/users/hairmare/followers","following_url":"https://api.github.com/users/hairmare/following{/other_user}","gists_url":"https://api.github.com/users/hairmare/gists{/gist_id}","starred_url":"https://api.github.com/users/hairmare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairmare/subscriptions","organizations_url":"https://api.github.com/users/hairmare/orgs","repos_url":"https://api.github.com/users/hairmare/repos","events_url":"https://api.github.com/users/hairmare/events{/privacy}","received_events_url":"https://api.github.com/users/hairmare/received_events","type":"User","site_admin":false},"body":"puhleeze... copypasta much","created_at":"2015-09-09T09:24:06Z","updated_at":"2015-09-09T09:24:06Z","html_url":"https://github.com/libgraviton/graviton/pull/251#discussion_r39022550","pull_request_url":"https://api.github.com/repos/libgraviton/graviton/pulls/251","_links":{"self":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/comments/39022550"},"html":{"href":"https://github.com/libgraviton/graviton/pull/251#discussion_r39022550"},"pull_request":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/251"}}},"pull_request":{"url":"https://api.github.com/repos/libgraviton/graviton/pulls/251","id":43741457,"html_url":"https://github.com/libgraviton/graviton/pull/251","diff_url":"https://github.com/libgraviton/graviton/pull/251.diff","patch_url":"https://github.com/libgraviton/graviton/pull/251.patch","issue_url":"https://api.github.com/repos/libgraviton/graviton/issues/251","number":251,"state":"open","locked":false,"title":"Add Queue-like functionality through RabbitMQ for async workers","user":{"login":"q-src","id":10114076,"avatar_url":"https://avatars.githubusercontent.com/u/10114076?v=3","gravatar_id":"","url":"https://api.github.com/users/q-src","html_url":"https://github.com/q-src","followers_url":"https://api.github.com/users/q-src/followers","following_url":"https://api.github.com/users/q-src/following{/other_user}","gists_url":"https://api.github.com/users/q-src/gists{/gist_id}","starred_url":"https://api.github.com/users/q-src/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/q-src/subscriptions","organizations_url":"https://api.github.com/users/q-src/orgs","repos_url":"https://api.github.com/users/q-src/repos","events_url":"https://api.github.com/users/q-src/events{/privacy}","received_events_url":"https://api.github.com/users/q-src/received_events","type":"User","site_admin":false},"body":"**current state**\r\n* we have 2 services (`/event/worker` and `/event/status`)\r\n* basic logic is complete. If there are workers subscribed on a certain event, an `/event/status` entry is persisted. the url to that resource is included in the Queue output.\r\n* the structure of the queue object generated is fixed through the `QueueEvent` document (also see below)\r\n* all necessary flow logic is implemented\r\n* many parameters have been removed to simplify. now, every change leads to a broadcast to the queue.\r\n* now, JSON is written to the queue. We write a serialized instance of `QueueEvent` to the queue. this looks like this: \r\n```\r\n{\"className\":\"Graviton\\\\CoreBundle\\\\Document\\\\App\",\"recordId\":\"admin\",\"event\":\"update\",\"publicUrl\":\"http:\\/\\/localhost:8000\\/core\\/app\\/admin\",\"statusUrl\":\"http:\\/\\/localhost:8000\\/event\\/status\\/8aa71f31044f3beebf2ea3fb123f4409\",\"routingKey\":\"document.core.app.update\"}\r\n```\r\nif there is an update on an object without a `Controller`, the field `publicUrl` will be `null`. If there is no worker subscribed on the event, no `EventStatus` will be created and thus `statusUrl` in the `QueueEvent` will be `null`.\r\n* `routingKey` is now always a 4 component string, i.e. `document.core.app.create`. so it's `document` (fixed prefix for doctrine stuff), then `[bundle].[document].[event]`\r\n* workers can subscribe with wildcards, but always 4 component subscription. thus, to receive all, one must subscribe on `document.*.*.*` or `*.*.*.*` - all to core app would be `document.core.app.*`.\r\n\r\n*todo*\r\n- [ ] write unit tests for the publisher and the basic flow\r\n- [ ] add tons of documentation on this feature (both in a README.md in the bundle and also on https://gravity-platform-docs.nova.scapp.io/api/)\r\n\r\n*old todo*\r\n- [x] The Bundle is renamed to GravitonRabbitMqBundle, as it is inevitably RabbitMQ specific\r\n- [x] All config parameters \"graviton.message.\\*\" are renamed to \"graviton.rabbitmq.\\*\"\r\n- [x] DocumentEventPublisher is final and all it's protected members are changed to private\r\n- [x] DocumentEventPublisher uses constructor arguments for setting $additionalProperties (optional, default value array()) and $documents (which must be set to private)\r\n- [x] MessageProducer uses constructor arguments for setting $registeredRoutingKeys (which must be set to protected)\r\n- [x] MessageProducer's $replyTo is removed, as it is not necessary\r\n- [x] The JobStatus document is renamed to WorkerStatus","created_at":"2015-08-31T08:16:28Z","updated_at":"2015-09-09T09:24:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9067cec27dda13faf64d0242d911ad28e55ba488","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgraviton/graviton/pulls/251/commits","review_comments_url":"https://api.github.com/repos/libgraviton/graviton/pulls/251/comments","review_comment_url":"https://api.github.com/repos/libgraviton/graviton/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libgraviton/graviton/issues/251/comments","statuses_url":"https://api.github.com/repos/libgraviton/graviton/statuses/417333eb168733facd494e43d2a6805e699dc053","head":{"label":"libgraviton:feature/rabbitmq","ref":"feature/rabbitmq","sha":"417333eb168733facd494e43d2a6805e699dc053","user":{"login":"libgraviton","id":4174061,"avatar_url":"https://avatars.githubusercontent.com/u/4174061?v=3","gravatar_id":"","url":"https://api.github.com/users/libgraviton","html_url":"https://github.com/libgraviton","followers_url":"https://api.github.com/users/libgraviton/followers","following_url":"https://api.github.com/users/libgraviton/following{/other_user}","gists_url":"https://api.github.com/users/libgraviton/gists{/gist_id}","starred_url":"https://api.github.com/users/libgraviton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgraviton/subscriptions","organizations_url":"https://api.github.com/users/libgraviton/orgs","repos_url":"https://api.github.com/users/libgraviton/repos","events_url":"https://api.github.com/users/libgraviton/events{/privacy}","received_events_url":"https://api.github.com/users/libgraviton/received_events","type":"Organization","site_admin":false},"repo":{"id":13440432,"name":"graviton","full_name":"libgraviton/graviton","owner":{"login":"libgraviton","id":4174061,"avatar_url":"https://avatars.githubusercontent.com/u/4174061?v=3","gravatar_id":"","url":"https://api.github.com/users/libgraviton","html_url":"https://github.com/libgraviton","followers_url":"https://api.github.com/users/libgraviton/followers","following_url":"https://api.github.com/users/libgraviton/following{/other_user}","gists_url":"https://api.github.com/users/libgraviton/gists{/gist_id}","starred_url":"https://api.github.com/users/libgraviton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgraviton/subscriptions","organizations_url":"https://api.github.com/users/libgraviton/orgs","repos_url":"https://api.github.com/users/libgraviton/repos","events_url":"https://api.github.com/users/libgraviton/events{/privacy}","received_events_url":"https://api.github.com/users/libgraviton/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgraviton/graviton","description":"","fork":false,"url":"https://api.github.com/repos/libgraviton/graviton","forks_url":"https://api.github.com/repos/libgraviton/graviton/forks","keys_url":"https://api.github.com/repos/libgraviton/graviton/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgraviton/graviton/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgraviton/graviton/teams","hooks_url":"https://api.github.com/repos/libgraviton/graviton/hooks","issue_events_url":"https://api.github.com/repos/libgraviton/graviton/issues/events{/number}","events_url":"https://api.github.com/repos/libgraviton/graviton/events","assignees_url":"https://api.github.com/repos/libgraviton/graviton/assignees{/user}","branches_url":"https://api.github.com/repos/libgraviton/graviton/branches{/branch}","tags_url":"https://api.github.com/repos/libgraviton/graviton/tags","blobs_url":"https://api.github.com/repos/libgraviton/graviton/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgraviton/graviton/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgraviton/graviton/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgraviton/graviton/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgraviton/graviton/statuses/{sha}","languages_url":"https://api.github.com/repos/libgraviton/graviton/languages","stargazers_url":"https://api.github.com/repos/libgraviton/graviton/stargazers","contributors_url":"https://api.github.com/repos/libgraviton/graviton/contributors","subscribers_url":"https://api.github.com/repos/libgraviton/graviton/subscribers","subscription_url":"https://api.github.com/repos/libgraviton/graviton/subscription","commits_url":"https://api.github.com/repos/libgraviton/graviton/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgraviton/graviton/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgraviton/graviton/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgraviton/graviton/issues/comments{/number}","contents_url":"https://api.github.com/repos/libgraviton/graviton/contents/{+path}","compare_url":"https://api.github.com/repos/libgraviton/graviton/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgraviton/graviton/merges","archive_url":"https://api.github.com/repos/libgraviton/graviton/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgraviton/graviton/downloads","issues_url":"https://api.github.com/repos/libgraviton/graviton/issues{/number}","pulls_url":"https://api.github.com/repos/libgraviton/graviton/pulls{/number}","milestones_url":"https://api.github.com/repos/libgraviton/graviton/milestones{/number}","notifications_url":"https://api.github.com/repos/libgraviton/graviton/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgraviton/graviton/labels{/name}","releases_url":"https://api.github.com/repos/libgraviton/graviton/releases{/id}","created_at":"2013-10-09T11:26:14Z","updated_at":"2015-08-20T11:09:50Z","pushed_at":"2015-09-09T09:13:43Z","git_url":"git://github.com/libgraviton/graviton.git","ssh_url":"git@github.com:libgraviton/graviton.git","clone_url":"https://github.com/libgraviton/graviton.git","svn_url":"https://github.com/libgraviton/graviton","homepage":"https://gravity-platform-docs.nova.scapp.io","size":8193,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":5,"default_branch":"develop"}},"base":{"label":"libgraviton:develop","ref":"develop","sha":"9c4a43667cce328dae8bd67d0bdc90a787b9b1c9","user":{"login":"libgraviton","id":4174061,"avatar_url":"https://avatars.githubusercontent.com/u/4174061?v=3","gravatar_id":"","url":"https://api.github.com/users/libgraviton","html_url":"https://github.com/libgraviton","followers_url":"https://api.github.com/users/libgraviton/followers","following_url":"https://api.github.com/users/libgraviton/following{/other_user}","gists_url":"https://api.github.com/users/libgraviton/gists{/gist_id}","starred_url":"https://api.github.com/users/libgraviton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgraviton/subscriptions","organizations_url":"https://api.github.com/users/libgraviton/orgs","repos_url":"https://api.github.com/users/libgraviton/repos","events_url":"https://api.github.com/users/libgraviton/events{/privacy}","received_events_url":"https://api.github.com/users/libgraviton/received_events","type":"Organization","site_admin":false},"repo":{"id":13440432,"name":"graviton","full_name":"libgraviton/graviton","owner":{"login":"libgraviton","id":4174061,"avatar_url":"https://avatars.githubusercontent.com/u/4174061?v=3","gravatar_id":"","url":"https://api.github.com/users/libgraviton","html_url":"https://github.com/libgraviton","followers_url":"https://api.github.com/users/libgraviton/followers","following_url":"https://api.github.com/users/libgraviton/following{/other_user}","gists_url":"https://api.github.com/users/libgraviton/gists{/gist_id}","starred_url":"https://api.github.com/users/libgraviton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgraviton/subscriptions","organizations_url":"https://api.github.com/users/libgraviton/orgs","repos_url":"https://api.github.com/users/libgraviton/repos","events_url":"https://api.github.com/users/libgraviton/events{/privacy}","received_events_url":"https://api.github.com/users/libgraviton/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgraviton/graviton","description":"","fork":false,"url":"https://api.github.com/repos/libgraviton/graviton","forks_url":"https://api.github.com/repos/libgraviton/graviton/forks","keys_url":"https://api.github.com/repos/libgraviton/graviton/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgraviton/graviton/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgraviton/graviton/teams","hooks_url":"https://api.github.com/repos/libgraviton/graviton/hooks","issue_events_url":"https://api.github.com/repos/libgraviton/graviton/issues/events{/number}","events_url":"https://api.github.com/repos/libgraviton/graviton/events","assignees_url":"https://api.github.com/repos/libgraviton/graviton/assignees{/user}","branches_url":"https://api.github.com/repos/libgraviton/graviton/branches{/branch}","tags_url":"https://api.github.com/repos/libgraviton/graviton/tags","blobs_url":"https://api.github.com/repos/libgraviton/graviton/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgraviton/graviton/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgraviton/graviton/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgraviton/graviton/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgraviton/graviton/statuses/{sha}","languages_url":"https://api.github.com/repos/libgraviton/graviton/languages","stargazers_url":"https://api.github.com/repos/libgraviton/graviton/stargazers","contributors_url":"https://api.github.com/repos/libgraviton/graviton/contributors","subscribers_url":"https://api.github.com/repos/libgraviton/graviton/subscribers","subscription_url":"https://api.github.com/repos/libgraviton/graviton/subscription","commits_url":"https://api.github.com/repos/libgraviton/graviton/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgraviton/graviton/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgraviton/graviton/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgraviton/graviton/issues/comments{/number}","contents_url":"https://api.github.com/repos/libgraviton/graviton/contents/{+path}","compare_url":"https://api.github.com/repos/libgraviton/graviton/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgraviton/graviton/merges","archive_url":"https://api.github.com/repos/libgraviton/graviton/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgraviton/graviton/downloads","issues_url":"https://api.github.com/repos/libgraviton/graviton/issues{/number}","pulls_url":"https://api.github.com/repos/libgraviton/graviton/pulls{/number}","milestones_url":"https://api.github.com/repos/libgraviton/graviton/milestones{/number}","notifications_url":"https://api.github.com/repos/libgraviton/graviton/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgraviton/graviton/labels{/name}","releases_url":"https://api.github.com/repos/libgraviton/graviton/releases{/id}","created_at":"2013-10-09T11:26:14Z","updated_at":"2015-08-20T11:09:50Z","pushed_at":"2015-09-09T09:13:43Z","git_url":"git://github.com/libgraviton/graviton.git","ssh_url":"git@github.com:libgraviton/graviton.git","clone_url":"https://github.com/libgraviton/graviton.git","svn_url":"https://github.com/libgraviton/graviton","homepage":"https://gravity-platform-docs.nova.scapp.io","size":8193,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/251"},"html":{"href":"https://github.com/libgraviton/graviton/pull/251"},"issue":{"href":"https://api.github.com/repos/libgraviton/graviton/issues/251"},"comments":{"href":"https://api.github.com/repos/libgraviton/graviton/issues/251/comments"},"review_comments":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/251/comments"},"review_comment":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libgraviton/graviton/pulls/251/commits"},"statuses":{"href":"https://api.github.com/repos/libgraviton/graviton/statuses/417333eb168733facd494e43d2a6805e699dc053"}}}}