{"action":"created","issue":{"url":"https://api.github.com/repos/apcera/gnatsd/issues/52","labels_url":"https://api.github.com/repos/apcera/gnatsd/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/apcera/gnatsd/issues/52/comments","events_url":"https://api.github.com/repos/apcera/gnatsd/issues/52/events","html_url":"https://github.com/apcera/gnatsd/pull/52","id":43599283,"number":52,"title":"Dynamic cluster route management","user":{"login":"chendo","id":2661,"avatar_url":"https://avatars.githubusercontent.com/u/2661?v=3","gravatar_id":"","url":"https://api.github.com/users/chendo","html_url":"https://github.com/chendo","followers_url":"https://api.github.com/users/chendo/followers","following_url":"https://api.github.com/users/chendo/following{/other_user}","gists_url":"https://api.github.com/users/chendo/gists{/gist_id}","starred_url":"https://api.github.com/users/chendo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chendo/subscriptions","organizations_url":"https://api.github.com/users/chendo/orgs","repos_url":"https://api.github.com/users/chendo/repos","events_url":"https://api.github.com/users/chendo/events{/privacy}","received_events_url":"https://api.github.com/users/chendo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2014-09-23T07:37:39Z","updated_at":"2015-02-23T00:16:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apcera/gnatsd/pulls/52","html_url":"https://github.com/apcera/gnatsd/pull/52","diff_url":"https://github.com/apcera/gnatsd/pull/52.diff","patch_url":"https://github.com/apcera/gnatsd/pull/52.patch"},"body":"We're using gnatsd inside Mesos/Marathon, so routes to other nodes can change often. We initially experimented with generating config files with routes from Marathon, however the config files would only have routes for the other gnatsd nodes at that point in time which was not ideal.\r\n\r\nI've implemented a `/routez` endpoint (mostly copied from `connz.go`) that allows listing, adding and removing routes.\r\n\r\nThe API is as follows:\r\n```\r\ncurl -X GET localhost:9222/routez # Returns list of routes\r\ncurl -X PUT localhost:9222/routez -d nats://<ip>:<port> # Add a route. I used PUT because gnatsd automatically handles duplicate routes\r\ncurl -X DELETE localhost:9222/routez -d nats://<ip>:<port> # Removes a route if it exists.\r\n```\r\n\r\nI used a simple text body because the route addition/removal didn't need to be that complex, and handling JSON requests would be slightly more complicated and unnecessary.\r\n\r\nIt would be handy to find out how many times a particular route has disconnected and reconnected, but wasn't a critical feature for us just yet."},"comment":{"url":"https://api.github.com/repos/apcera/gnatsd/issues/comments/75474592","html_url":"https://github.com/apcera/gnatsd/pull/52#issuecomment-75474592","issue_url":"https://api.github.com/repos/apcera/gnatsd/issues/52","id":75474592,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T00:16:52Z","updated_at":"2015-02-23T00:16:52Z","body":"\n[![Coverage Status](https://coveralls.io/builds/1975462/badge)](https://coveralls.io/builds/1975462)\n\nCoverage decreased (-1.18%) to 63.73% when pulling **2711852f258ecccb2380a2d5d2bb32c9d458ca6c on chendo:master** into **2758974735a0cce12d75ea5fd2337ac3b0f52317 on apcera:master**.\n"}}