{"action":"created","issue":{"url":"https://api.github.com/repos/project8/dripline/issues/160","repository_url":"https://api.github.com/repos/project8/dripline","labels_url":"https://api.github.com/repos/project8/dripline/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/project8/dripline/issues/160/comments","events_url":"https://api.github.com/repos/project8/dripline/issues/160/events","html_url":"https://github.com/project8/dripline/issues/160","id":170445666,"number":160,"title":"All exchange declarations should happen every time a service starts","user":{"login":"laroque","id":830135,"avatar_url":"https://avatars.githubusercontent.com/u/830135?v=3","gravatar_id":"","url":"https://api.github.com/users/laroque","html_url":"https://github.com/laroque","followers_url":"https://api.github.com/users/laroque/followers","following_url":"https://api.github.com/users/laroque/following{/other_user}","gists_url":"https://api.github.com/users/laroque/gists{/gist_id}","starred_url":"https://api.github.com/users/laroque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laroque/subscriptions","organizations_url":"https://api.github.com/users/laroque/orgs","repos_url":"https://api.github.com/users/laroque/repos","events_url":"https://api.github.com/users/laroque/events{/privacy}","received_events_url":"https://api.github.com/users/laroque/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/project8/dripline/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/project8/dripline/labels/help%20wanted","name":"help wanted","color":"fbca04"},{"url":"https://api.github.com/repos/project8/dripline/labels/urgent","name":"urgent","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-10T15:25:42Z","updated_at":"2016-09-22T18:37:33Z","closed_at":null,"body":"As currently implemented, starting a new dripline service does not always ensure that all exchanges are declared prior to binding to them. In particular, on a new rabbitmq server, `dragonfly serve -c <any config>` will not declare the alerts exchange. There is a simple workaround (starting and then killing `dragonfly monitor`, which does declare that exchange).\r\n\r\nThe fix should probably come in two steps, the first one sufficient for a while, the second a cleaner design:\r\n\r\n1. Modify `Service` such that it always declares both the requests and the alerts exchange, regardless of what binding(s) will eventually happen.\r\n2. What should really happen is that `Service` should declare both queues *and* should go ahead and make all of the universal bindings (on alerts, bind to everything; on requests, bind to broadcast.# and <self.name>.#). The service setup subcommand could then create further bindings for associated endpoints if/as needed. For this to work, `Service` would also need an overridable method to handle request messages and ignore them. This would be in two steps, one method has the standard on_alert signature and would acknowledge and then decode the message into a dripline.core.Message object which would then be passed to an overridable message to actually implement whatever logic is wanted (probably just a pass in `Service`)."},"comment":{"url":"https://api.github.com/repos/project8/dripline/issues/comments/248990219","html_url":"https://github.com/project8/dripline/issues/160#issuecomment-248990219","issue_url":"https://api.github.com/repos/project8/dripline/issues/160","id":248990219,"user":{"login":"laroque","id":830135,"avatar_url":"https://avatars.githubusercontent.com/u/830135?v=3","gravatar_id":"","url":"https://api.github.com/users/laroque","html_url":"https://github.com/laroque","followers_url":"https://api.github.com/users/laroque/followers","following_url":"https://api.github.com/users/laroque/following{/other_user}","gists_url":"https://api.github.com/users/laroque/gists{/gist_id}","starred_url":"https://api.github.com/users/laroque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laroque/subscriptions","organizations_url":"https://api.github.com/users/laroque/orgs","repos_url":"https://api.github.com/users/laroque/repos","events_url":"https://api.github.com/users/laroque/events{/privacy}","received_events_url":"https://api.github.com/users/laroque/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T18:37:33Z","updated_at":"2016-09-22T18:37:33Z","body":"I don't think that that alternative possibility is a clean solution. You say that there are non-fatal errors, does that mean that we have a workaround currently (even if that is just manually creating the required exchanges)?\r\n\r\nThe right solution, in an somewhat abstract sense, is that any object which interacts with AMQP (generally `Service` or classes derived from it) should always make the proper exchange declarations prior to trying to interact with those exchanges. If we're getting errors about `no exchange '<whatever>'` then there is a bug in this logic and we need to re-evaluate the full sequence of actions when an object is created and when the service is started, including the \"on success\" callbacks pika makes.\r\n\r\nThis is a rather non-trivial job, so a workaround, even a \"bootstrap\" script to run on new rabbitMQ instances is probably a reasonable near term solution."}}
{"actor":{"display_login":"laroque"}}